_IO_file_underflow_mmap read call for atime
Ulrich Drepper
drepper@redhat.com
Tue Jul 30 14:50:00 GMT 2002
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 `------------------------
More information about the Libc-hacker
mailing list