delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/02/13/15:32:11

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <3A89938B.75BBCE81@beamreachnetworks.com>
Date: Tue, 13 Feb 2001 12:05:31 -0800
From: "Eric M. Monsler" <emonsler AT beamreachnetworks DOT com>
X-Mailer: Mozilla 4.76 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
To: jik-cygwin AT curl DOT com
CC: cygwin AT cygwin DOT com
Subject: Re: Optimizing away "ReadFile" calls when Make calls stat()
References: <20010213183634 DOT 1435 DOT qmail AT lizard DOT curl DOT com> <3A898A3A DOT 111A7D5C AT beamreachnetworks DOT com> <20010213192844 DOT 16294 DOT qmail AT lizard DOT curl DOT com>


jik-cygwin AT curl DOT com wrote:
> 
(snip)
> 
> >  For everything in the system?  Is your proposed change MT-safe?
> 
> It would have to be made MT-safe, obviously.  While I am not
> intimately familiar with how to do such a thing in Cygwin DLL code, I
> am confident that the more knowledgeable maintainers of the code would
> be able to do so easily.

Do you think so?  Does the DLL maintain "state" for every process which
may make cygwin system calls?  Are there different levels of state for
processes vs. threads, such that if one thread was in the middle of a
set_stat_options()/stat()/set_stat_options() operation and another
thread attempted a stat(), the stat() in the other thread would get the
POSIX behavior, because inside the stat() call the DLL checked the
set_stat_options() state for this thread and found that it had not been
changed?

I am philosophically opposed to anything that changes system call
behavior.  I am doubtfull that even experts can see all consequences. 
Even *fixing* behaviors can break code that had successfully worked
around the previous behavior.

If a DLL modification is really required, how about a new function,
substat(), which checks on the file and returns in the struct only those
fields that are set to non-null when the substat() is called?

struct stat *pStatBuff;
...

/* Identical to current "stat" */
memset(pStatBuff, 0xff, sizeof(*pStatBuff));
substat(pPath,pStatBuff);

/* A long and expensive NOP */
memset(pStatBuff, 0x0, sizeof(*pStatBuff));
substat(pPath,pStatBuff);

/* Get just last modification time */
memset(pStatBuff, 0x0, sizeof(*pStatBuff));
pStatBuff->st_mtime = 1;
substat(pPath,pStatBuff);


On the other hand, it sounds as if you have a working version of make
that suits your needs right now.  How many other applications are
expected to use substat(), or any other Cygwin-only system call like
set_stat_options()?


Eric M. Monsler

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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