Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com Date: Mon, 17 Sep 2001 18:37:34 +0200 From: Corinna Vinschen To: Cygwin-Developers Subject: Re: WriteFile() whacks st_atime patch Message-ID: <20010917183734.D10081@cygbert.vinschen.de> Reply-To: cygdev Mail-Followup-To: Corinna Vinschen , Cygwin-Developers References: <1000218262 DOT 7293 DOT 272 DOT camel AT lifelesswks> <20010917093833 DOT I2272 AT dothill DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010917093833.I2272@dothill.com>; from jason@tishler.net on Mon, Sep 17, 2001 at 09:38:33AM -0400 On Mon, Sep 17, 2001 at 09:38:33AM -0400, Jason Tishler wrote: > 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, since your both patches to set the file time will probably result in a performance loss and since only a few applications have a problem with the windows behaviour... what do you think about conditionalize your patch using a global flag (e.g. force_unix_ftime_behaviour) which is set to FALSE by default? If somebody want's to link an application so that it sets the filetime accordingly, it could be linked against a `setftime.o' file which we could build in the cygwin source dir and which is used as the binmode.o/textmode.o/automode.o files. The setftime.c file would simply look like: void cygwin_premain1 (int argc, char **argv, struct per_process *myself) { extern BOOL force_unix_ftime_behaviour; force_unix_ftime_behaviour = TRUE; } Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Developer mailto:cygwin AT cygwin DOT com Red Hat, Inc.