From owner-freebsd-hackers Thu Apr 30 20:29:27 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id UAA15878 for freebsd-hackers-outgoing; Thu, 30 Apr 1998 20:29:27 -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 UAA15869 for ; Thu, 30 Apr 1998 20:29:17 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.8.8/8.8.6) id WAA20979; Thu, 30 Apr 1998 22:29:14 -0500 (CDT) Message-ID: <19980430222914.A20607@emsphone.com> Date: Thu, 30 Apr 1998 22:29:14 -0500 From: Dan Nelson To: Terry Lambert Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: how to fseek past 2GB? References: <19980429150055.A17639@emsphone.com> <199804300753.AAA00308@usr05.primenet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.92.4i In-Reply-To: <199804300753.AAA00308@usr05.primenet.com>; from "Terry Lambert" on Thu Apr 30 07:53:58 GMT 1998 X-OS: FreeBSD 2.2.6-STABLE Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In the last episode (Apr 30), Terry Lambert said: > > 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*/ > ... > > It'd be easy to wrap this. 8-). Actually, this is illegal according to the man page at http://www.opengroup.org/onlinepubs/7908799/xsh/stdio.h.html . fseek is only allowed to seek to file offsets that ftell could return: [EOVERFLOW] For fseek(), the resulting file offset would be a value which cannot be represented correctly in an object of type long. Should I code for this error case, or let fseek hopscotch into the >2GB area? Are there any programs that even know it's possible? -Dan Nelson dnelson@emsphone.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message