This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


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

Re: WriteFile() whacks st_atime patch


On Wed, Sep 12, 2001 at 12:24:21AM +1000, Robert Collins wrote:
> On Tue, 2001-09-11 at 06:22, Corinna Vinschen wrote:
> > On Mon, Sep 10, 2001 at 03:44:31PM -0400, Jason Tishler wrote: 
> > > Given the above problems, I have very mixed feelings about this patch.
> > > Is it worth pursuing or should I dropped it?
> > 
> > Frankly, I don't know.  My first guess is to prioritize correctness
> > over speed and with your patch the functionality seems to be at 
> > least `more correct'.  Would it perhaps make sense to change
> > that to something like:
> 
> I think correctness in this case is well worth it, as it's obviously
> causing some problems out there. However, it would be good to bench the
> difference building cygwin or something, to see the impact.

I will attempt to benchmark the performance impact using both a
specialized test program (e.g., writes with and without GetFileTime and
SetFileTime calls) and a more generalized scenario such as building
Cygwin (as Rob suggested).

BTW, while fiddling around, I discovered that an overridden raw_read()
will be need too:

    int
    fhandler_disk_file::raw_read (void *ptr, size_t len)
    {
      int bytes_read = fhandler_base::raw_read(ptr, len);
      if (bytes_read > 0)
        {
          FILETIME now;
          BOOL status = GetSystemTimeAsFileTime (&now);
          if (status)
            SetFileTime (get_handle(), 0, &now, 0);
        }
      return bytes_read;
    }

It appears that Windows does not update the last access time until the
file is closed or at least not immediately (possibly due to caching?).
In contract, on Red Linux 7.1, st_atime is updated immediately upon a
read -- even if the file is still open.

Jason


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