This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [RFA] A kinder, gentler check for /etc/{passwd,group} changes


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@cygwin.com
Red Hat, Inc.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]