This is the mail archive of the cygwin@sources.redhat.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: Optimizing away "ReadFile" calls when Make calls stat()




jik-cygwin@curl.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


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