This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Re: Bogue des bibliotheques C sous LINUX


On Jun 20, 2001, <jlnouzille@ifrance.com> wrote:

> Bonjour,

Bonjour.  Please forgive me for not replying in French.  I can barely
read French, so my attempting to write in French would certainly be a
disaster :-)

> Correctif à faire :
> #define __S_ISTYPE(mode, mask)  (((mode) & (mask)) ==
> (mask))

This wouldn't be right.  Take, for example, S_IFDIR (0040000) and
S_IFLBLK (0060000): should S_ISTYPE be implemented as you suggest, a
block device would be recognized as a directory, which would be
certainly wrong.  The current implementation appears to be correct:
__S_IFMT chooses the bits that are used to determine the file type, and
the various S_IS* macros compare the masked file mode with the
intended bit pattern.

The only case in which you might get wrong results, I suppose, is if
the kernel started using different bits to represent the various file
types, and you're compiling your application using kernel headers of a
different version.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me


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