_IO_file_underflow_mmap read call for atime
Jakub Jelinek
jakub@redhat.com
Tue Jul 30 15:29:00 GMT 2002
On Tue, Jul 30, 2002 at 02:46:41PM -0700, Ulrich Drepper wrote:
> 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( ).
Fine, cannot we mmap at the time of the first read then (and if fall back to
non-mmap stdio if that is not possible)?
Jakub
More information about the Libc-hacker
mailing list