[Developers] Bug fix for bug 1864 on all platforms.

Jonathan Thornburg jthorn at aei.mpg.de
Thu Jun 23 09:23:45 CDT 2005


> We query the st_mode parameter set by the stat command. We can test if this
> parameter is pointing to a directory by doing a "bitwise and" with 0040000
> which is the value of S_IFDIR. This constant is also present in Windows but it
> is called _S_IFDIR. This patch will work on windows as the value of _S_IFDIR is
> also 0040000. This is same on all the platforms only the name of the constant is
> different. For example, the same constant is called S_IFDIR in Linux but it has
> the same value as above.

Ick.  *Please* don't embed OS-specific assumptions like this!
You have know way of knowing if (say) one of the BSDs -- or AIX or
IRIX or any of the 6.02e23 other operating systems on which we need
to run Cactus -- uses a different value for this bit mask, or even
encodes things in some form other than a bit mask.

There's a reason POSIX defines S_IFDIR() MACRO rather than the bit
fields, namely portability.  We should use the macro on all POSIX

I don't really care what we do on non-POSIX platforms.


-- Jonathan Thornburg <jthorn at aei.mpg.de>
    Max-Planck-Institut fuer Gravitationsphysik (Albert-Einstein-Institut),
    Golm, Germany, "Old Europe"     http://www.aei.mpg.de/~jthorn/home.html
    "Washing one's hands of the conflict between the powerful and the
     powerless means to side with the powerful, not to be neutral."
                                       -- quote by Freire / poster by Oxfam

More information about the Developers mailing list