fopen + mmap

Roland McGrath roland@frob.com
Sat Jan 19 12:31:00 GMT 2002


> Jakub Jelinek <jakub@redhat.com> writes:
> 
> > fflush will move the kernel file position to the current read position.
> 
> Actually, you'll need fseek() (better fseeko()) to be sure.  It is not
> guaranteed that the descriptor is at the beginning of the file.

I don't follow your reading of the standards here.  After fopen, the new
stream's file position indicator is at the beginning of the file.
Immediately after fflush, all handles' positions match the last one used.
Since the stream was the only one used, that means the new handle created
by fileno should match the stream's position as of the fflush call,
which is the beginning of the file.



More information about the Libc-hacker mailing list