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


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


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