www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2001/09/08/20:12:28

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
Subject: Re: cygwin slowdown in current cvs version
From: Robert Collins <robert DOT collins AT itdomain DOT com DOT au>
To: cygwin-developers AT cygwin DOT com
In-Reply-To: <20010908164412.B13528@redhat.com>
References: <130160175780 DOT 20010908204017 AT logos-m DOT ru>
<127165775081 DOT 20010908221336 AT logos-m DOT ru>
<186168543292 DOT 20010908225944 AT logos-m DOT ru> <20010908155203 DOT C12571 AT redhat DOT com>
<20010908222326 DOT B937 AT cygbert DOT vinschen DOT de>
<20010908164412 DOT B13528 AT redhat DOT com>
X-Mailer: Evolution/0.13 (Preview Release)
Date: 09 Sep 2001 10:13:06 +1000
Message-Id: <999994387.9504.118.camel@lifelesswks>
Mime-Version: 1.0
X-OriginalArrivalTime: 08 Sep 2001 23:59:58.0150 (UTC) FILETIME=[5D32B660:01C138C2]

On Sun, 2001-09-09 at 06:44, Christopher Faylor wrote:
> On Sat, Sep 08, 2001 at 10:23:26PM +0200, Corinna Vinschen wrote
> 
> If we were going to do that, though, we should set up one global "change
> notification" handle for /etc/group and /etc/passwd, right?

After a quick MSDN scan, I couldn't see any per file scanning mechanism.
which means notification on /etc is about it (barring fancy tricks like
/etc/changingdata/passwd and /etc/passwd->changindata/passwd :])


> Index: passwd.cc
> ===================================================================
>       if (!pwd_w32[0])	/* First call. */


>         {
> ! 	char *p;
> ! 	path_conv pwd ("/etc/passwd", PC_SYM_FOLLOW | PC_FULL);
> ! 	if (!pwd.error)
> ! 	  strcpy (pwd_w32, pwd);
> ! 	if ((p = strrchr (pwd, '\\')) != NULL)
>   	  {
> ! 	    *p = '\0';
> ! 	    hchanged = FindFirstChangeNotification (pwd, FALSE,
> ! 						    FILE_NOTIFY_CHANGE_LAST_WRITE);
> ! 	    if (hchanged == INVALID_HANDLE_VALUE)
>   	      {
> ! 		system_printf ("hchanged '%s', %p, %E", (char *) pwd, hchanged);
> ! 		hchanged = NULL;
> ! 	      }
>   	  }
> !       }
> !     else if (hchanged && WaitForSingleObject (hchanged, 0) == WAIT_OBJECT_0)
> !       {
> ! 	(void) FindNextChangeNotification (hchanged);
> ! small_printf ("/etc changed\n");
> ! 	state = uninitialized;

This is wrong - it doesn't mean /etc/pwd was altered, just /etc. We
should now fstat /etc/passwd and then return. Otherwise every change to
anything in /etc - including /etc itself will result in a re-read.

On the other hand perhaps just rereading is faster than fstat :]?
(Remembering the common case will be read once).

>         }
>       return state;
>     }


- Raw text -


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