From owner-freebsd-hackers Wed Apr 29 13:01:12 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id NAA15465 for freebsd-hackers-outgoing; Wed, 29 Apr 1998 13:01:12 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from dan.emsphone.com (dan@dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id NAA15445 for ; Wed, 29 Apr 1998 13:01:02 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.8.8/8.8.6) id PAA17809 for freebsd-hackers@freebsd.org; Wed, 29 Apr 1998 15:00:55 -0500 (CDT) Message-ID: <19980429150055.A17639@emsphone.com> Date: Wed, 29 Apr 1998 15:00:55 -0500 From: Dan Nelson To: freebsd-hackers@FreeBSD.ORG Subject: how to fseek past 2GB? Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.92.1i X-OS: FreeBSD 2.2.6-STABLE Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I recently noticed that there is no way to fseek() past the 2GB mark on files opened with fopen(). The offset in the FILE struct is an fpos_t; there's just no way to get at it. fseek(), unfortunately, is cursed with a "long" file offset, so that can't change. fsetpos() _could_ seek past the 2GB mark, since a fpos_t is a long long. Our current fsetpos implementation simply calls (fseek(iop, (long)*pos, SEEK_SET)), though. What I did for my own use is create lfseek() and lftell() functions that basically copy the fseek() and ftell() source, but replace "long" with "fpos_t". It works great. If I were to submit these as a PR, what would be the best way to do it? I'm leaning toward making fseek() and fsetpos() call lfseek(), to eliminate redundant code. Is there a "standard" function name for a fseek() function that takes an off_t or fpos_t? -Dan Nelson dnelson@emsphone.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message