From owner-freebsd-hackers Thu Apr 30 00:54:24 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id AAA27468 for freebsd-hackers-outgoing; Thu, 30 Apr 1998 00:54:24 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from smtp02.primenet.com (daemon@smtp02.primenet.com [206.165.6.132]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id AAA27449 for ; Thu, 30 Apr 1998 00:54:16 -0700 (PDT) (envelope-from tlambert@usr05.primenet.com) Received: (from daemon@localhost) by smtp02.primenet.com (8.8.8/8.8.8) id AAA24372; Thu, 30 Apr 1998 00:54:10 -0700 (MST) Received: from usr05.primenet.com(206.165.6.205) via SMTP by smtp02.primenet.com, id smtpd024313; Thu Apr 30 00:54:00 1998 Received: (from tlambert@localhost) by usr05.primenet.com (8.8.5/8.8.5) id AAA00308; Thu, 30 Apr 1998 00:53:59 -0700 (MST) From: Terry Lambert Message-Id: <199804300753.AAA00308@usr05.primenet.com> Subject: Re: how to fseek past 2GB? To: dnelson@emsphone.com (Dan Nelson) Date: Thu, 30 Apr 1998 07:53:58 +0000 (GMT) Cc: freebsd-hackers@FreeBSD.ORG In-Reply-To: <19980429150055.A17639@emsphone.com> from "Dan Nelson" at Apr 29, 98 03:00:55 pm X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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. Heh. ... fseek( fp, 1<<30, SEEK_SET); /* first 2G*/ fseek( fp, 1<<30, SEEK_CUR); /* next 2G*/ fseek( fp, 1, SEEK_END); /* last byte*/ ... It'd be easy to wrap this. 8-). For a more FreeBSD-specific workaround: off_t lfseek( FILE *fp, off_t offset, int whence) { off_t new; fp->_flags &= ~__SOFF; /* invalidate offset cache*/ new = lseek( fileno(fp), offset, whence); fseek( fp, 0, SEEK_CUR); return( new); } On your patches: I think there are standard names for the functions you implemented, so they should probably be rolled in. But the workarounds should work for 2.2.6 people. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message