www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2001/07/26/10:40:34

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-developers-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
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:40:27 -0400
From: Jason Tishler <jason AT tishler DOT net>
To: Cygwin-Developers <cygwin-developers AT sources DOT redhat DOT com>
Subject: stat() whacks st_atime
Message-ID: <20010726104027.B439@dothill.com>
Mail-Followup-To: Cygwin-Developers <cygwin-developers AT sources DOT redhat DOT com>
Mime-Version: 1.0
User-Agent: Mutt/1.3.18i
Organization: Dot Hill Systems Corp.

--99ZPEIXx3lfS0q7H
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

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.

Does anyone understand what is going on?

BTW, this issue prevents mutt from detecting new mail in mbox folders.
I was able to temporarily workaround this issue by reconfiguring with
"--enable-buffy-size".

Thanks,
Jason

-- 
Jason Tishler
Director, Software Engineering       Phone: 732.264.8770 x235
Dot Hill Systems Corp.               Fax:   732.264.8798
82 Bethany Road, Suite 7             Email: Jason DOT Tishler AT dothill DOT com
Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com

--99ZPEIXx3lfS0q7H
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="stest.c"

#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <time.h>

int
main(int argc, char* argv[])
{
	struct stat buf;
	time_t now;

	now = time(0);
	printf("now = %s", ctime(&now));

	stat(argv[1], &buf);
	printf("access time = %s", ctime(&buf.st_atime));
	printf("modify time = %s", ctime(&buf.st_mtime));
}

--99ZPEIXx3lfS0q7H--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019