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


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

The spec gives wide latitude in how mmap can behave.  It allows st_atime to
be updated at any time between mmap and munmap.  But it only requires that
it be updated by the time of the first successful access to a mapped area.

If we assume that the mmap implementations we are using in fact also meet
the stricter criterion of updating st_atime on each read fault, then it is
safe to just use mmap and st_atime will meet the POSIX stdio rules.  I
haven't experimented on Linux, but this is certainly how mmap behaves on
GNU/Hurd.


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