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: Thu, 26 Jul 2001 10:45:39 -0400 From: Christopher Faylor To: Cygwin-Developers Subject: Re: stat() whacks st_atime Message-ID: <20010726104539.B16848@redhat.com> Reply-To: cygwin-developers AT cygwin DOT com Mail-Followup-To: Cygwin-Developers References: <20010726104027 DOT B439 AT dothill DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.11i In-Reply-To: <20010726104027.B439@dothill.com>; from jason@tishler.net on Thu, Jul 26, 2001 at 10:40:27AM -0400 On Thu, Jul 26, 2001 at 10:40:27AM -0400, Jason Tishler wrote: >I'm trying to track down why st_atime gets "whacked" when calling >stat(). By "whacked," I mean set to the current time (or thereabouts). > >The attached program, stest.c, demonstrates the problem. If one calls >it repeatedly, then the specified file's st_atime keeps changing. > >I've tracked down the problem to the following (in fhandler.cc): > > int > fhandler_base::close (void) > { > int res = -1; > > syscall_printf ("handle %p", get_handle()); >[1] if (CloseHandle (get_handle())) >[2] res = 0; > ... > } > >The st_atime is actually not affected directly by stat() and if stest is >stopped at [1] above, then the file's st_atime value is still unchanged >(as verified by a Win32 program). If gdb continues to [2], then the >file's st_atime has been changed. > >Unfortunately, I cannot figure out what is affecting the change. Is >there a Cygwin background thread that wakes up when the handle is >closed and somehow affects the file's st_atime? Or, can CloseHandle() >itself somehow be the culprit. I'm really perplexed. I suspect that a simple test case would help unperplex you. I also suspect that CloseHandle is updating the atime. cgf