delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2001/09/09/12:53:47

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: Sun, 9 Sep 2001 18:53:34 +0200
From: Corinna Vinschen <vinschen AT redhat DOT com>
To: cygwin-developers AT cygwin DOT com
Subject: Re: [RFA] A kinder, gentler check for /etc/{passwd,group} changes
Message-ID: <20010909185334.F937@cygbert.vinschen.de>
Reply-To: cygdev <cygwin-developers AT cygwin DOT com>
Mail-Followup-To: cygwin-developers AT cygwin DOT com
References: <20010908225133 DOT A17336 AT redhat DOT com> <20010909152458 DOT D937 AT cygbert DOT vinschen DOT de> <20010909121645 DOT A8059 AT redhat DOT com>
Mime-Version: 1.0
User-Agent: Mutt/1.2.5i
In-Reply-To: <20010909121645.A8059@redhat.com>; from cgf@redhat.com on Sun, Sep 09, 2001 at 12:16:45PM -0400

On Sun, Sep 09, 2001 at 12:16:45PM -0400, Christopher Faylor wrote:
> On Sun, Sep 09, 2001 at 03:24:58PM +0200, Corinna Vinschen wrote:
> >I did that since opening a file and getting the modification date
> >by GetFileInformationByHandle() is more costly than FindFirstFile().
> >
> >Think of the difference.  Getting the modification time when opened
> >the file the first time would be cheap since the file handle is
> >already open.  Getting the modification time on each file check
> >by opening the file and calling GetFileInf...() isn't that cheap
> >anymore.
> 
> Yes, but we are guaranteed to be opening the file later on.  The
> modification times could be stored then.  I think that's what Robert
> is saying.
> 
> I agree that repeatedly opening and closing the file isn't required
> when you're just checking to see if the file has been modified.  However,
> when you are definitely going to be opening the file, I don't see any
> reason to use the FindFirstFile method.

Sure but that's not the case here, anyway.  Checking should avoid
useless opening of a file.  So just for checking the call to FindFirstFile()
is cheaper.  The patch as it is now avoids even to call FindFirstFile()
for the check on the first call.  The fopen("/etc/...") is done
immediately and the timestamp is changed using that open file handle
and the GetFileInformationByHandle() call.  Only later tests call
FindFirstFile() and only after the etc_changed() method returns that a
change to /etc has happened.

> 
> Anyway, this patch looks good.  Can you check it in?

Done.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin AT cygwin DOT com
Red Hat, Inc.

- Raw text -


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