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: _IO_file_underflow_mmap read call for atime


Roland McGrath wrote:
The POSIX rules for mmap on files require that mmap'ing and reading a page
set the atime.  I don't see how the rules for stdio affecting atime (via
the "underlying functions" clauses) could be violated by the libio mmap'd
buffer implementation if mmap behaves as specified.  So the read call in
_IO_file_underflow_mmap is unnecessary.  Am I missing something?
The problem is timing. mmap affects atime, yes, but at the time the mmap happens. The I/O stream rules require that atime is modified at the time of the first read operation.

from the fgetc spec:

The st_atime field shall be marked for update by the first successful
execution of fgetc( ), fgets( ), fgetwc( ), fgetws( ), fread( ),
fscanf( ), getc( ), getchar( ), gets( ), or scanf( ) using stream that
returns data not supplied by a prior call to ungetc( ) or ungetwc( ).

--
---------------. ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Red Hat `--' drepper at redhat.com `------------------------


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