Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Nov 1998 08:50:01 -0800 (PST)
From:      Dan Nelson <dnelson@emsphone.com>
To:        freebsd-bugs@FreeBSD.ORG
Subject:   Re: bin/8637: fgetpos()/fsetpos() don't work for >2GB filesize
Message-ID:  <199811101650.IAA27907@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/8637; it has been noted by GNATS.

From: Dan Nelson <dnelson@emsphone.com>
To: FreeBSD-gnats-submit@FreeBSD.ORG
Cc:  Subject: Re: bin/8637: fgetpos()/fsetpos() don't work for >2GB filesize
Date: Tue, 10 Nov 1998 10:46:28 -0600

 And here is the documentation to go along with the code:
 
 Index: Makefile.inc
 ===================================================================
 RCS file: /home/ncvs/src/lib/libc/stdio/Makefile.inc,v
 retrieving revision 1.6.2.2
 diff -u -r1.6.2.2 Makefile.inc
 --- Makefile.inc	1998/04/13 23:20:52	1.6.2.2
 +++ Makefile.inc	1998/11/10 15:11:58
 @@ -30,6 +30,7 @@
  MLINKS+=fputs.3 puts.3
  MLINKS+=fread.3 fwrite.3
  MLINKS+=fseek.3 fgetpos.3 fseek.3 fsetpos.3 fseek.3 ftell.3 fseek.3 rewind.3
 +MLINKS+=fseek.3 fseeko.3 fseek.3 ftello.3
  MLINKS+=funopen.3 fropen.3 funopen.3 fwopen.3
  MLINKS+=getc.3 fgetc.3 getc.3 getchar.3 getc.3 getw.3
  MLINKS+=mktemp.3 mkdtemp.3 mktemp.3 mkstemp.3
 Index: fseek.3
 ===================================================================
 RCS file: /home/ncvs/src/lib/libc/stdio/fseek.3,v
 retrieving revision 1.1.1.1.8.1
 diff -u -r1.1.1.1.8.1 fseek.3
 --- fseek.3	1998/02/17 17:28:44	1.1.1.1.8.1
 +++ fseek.3	1998/11/10 16:26:54
 @@ -41,8 +41,10 @@
  .Sh NAME
  .Nm fgetpos ,
  .Nm fseek ,
 +.Nm fseeko ,
  .Nm fsetpos ,
  .Nm ftell ,
 +.Nm ftello ,
  .Nm rewind
  .Nd reposition a stream
  .Sh SYNOPSIS
 @@ -57,6 +59,10 @@
  .Fn fgetpos "FILE *stream" "fpos_t *pos"
  .Ft int
  .Fn fsetpos "FILE *stream" "const fpos_t *pos"
 +.Ft int
 +.Fn fseeko "FILE *stream" "off_t offset" "int whence"
 +.Ft off_t
 +.Fn ftello "FILE *stream"
  .Sh DESCRIPTION
  The
  .Fn fseek
 @@ -106,6 +112,19 @@
  .Xr clearerr 3 ) .
  .Pp
  The
 +.Fn fseeko
 +and
 +.Fn ftello
 +functions
 +are alternate interfaces equivalent to
 +.Fn ftell
 +and
 +.Fn fseek ,
 +but take an off_t argument instead of a long.  On systems that use a 32-bit
 +long type but support 64-bit filesizes, this is the only way to seek past the
 +2-gigabyte point.
 +.Pp
 +The
  .Fn fgetpos
  and
  .Fn fsetpos
 @@ -133,10 +152,14 @@
  Upon successful completion,
  .Fn fgetpos ,
  .Fn fseek ,
 +.Fn fseeko ,
 +and
  .Fn fsetpos
  return 0,
  and
  .Fn ftell
 +and
 +.Fn ftello
  returns the current offset.
  Otherwise, \-1 is returned and the global variable errno is set to
  indicate the error.
 @@ -157,14 +180,21 @@
  .Dv SEEK_END ,
  or
  .Dv SEEK_CUR .
 +.It Bq Er EFBIG
 +For 
 +.Fn ftello ,
 +the resulting file offset would be a value which
 +cannot be represented correctly in an object of type off_t.
  .El
  .Pp
 -The function
 +The functions
  .Fn fgetpos ,
  .Fn fseek ,
 +.Fn fseeko ,
  .Fn fsetpos ,
 -and 
 -.Fn ftell
 +.Fn ftell ,
 +and
 +.Fn ftello
  may also fail and set
  .Va errno
  for any of the errors specified for the routines
 @@ -186,3 +216,16 @@
  functions
  conform to
  .St -ansiC .
 +.Pp
 +The
 +.Fn fseeko 
 +and
 +.Fn ftello
 +functions conform to the X/Open Single UNIX Specification, Version 2.
 +.Sh BUGS
 +The 
 +.Bq Er EFBIG
 +error return should be 
 +.Bq Er EOVERFLOW 
 +according to the Single Unix specification, but FreeBSD has no
 +.Bq Er EOVERFLOW .

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199811101650.IAA27907>