This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: fopen + mmap


> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]