This is the mail archive of the glibc-linux@ricardo.ecn.wfu.edu mailing list for the glibc project.


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

_GNU_SOURCE, _XOPEN_SOURCE and __USE_UNIX98


Hi,

Can anybody enlighten me on the usage of __USE_UNIX98 in glibc-2.1.1?
To be a little more accurate, I'd like to use the pthread_rwlock_xxxx
stuffs (linuxthread-0.8).  According to pthread.h, __USE_UNIX98 must 
be defined. 
Butenhof seems to be using X/Open XSH5 and UNIX98 interchangably, and
then suggests that a system conformance to XSH5 is to be recognized
in unistd.h by a definition of _XOPEN_VERSION to 500 or higher.

There seems to be a little inconsistency, in the following way:
unistd.h starts by including features.h which goes like:

// from features.h
. . .
#undef __USE_UNIX98
. . . 
#ifdef  _XOPEN_SOURCE
# define __USE_XOPEN    1
# if (_XOPEN_SOURCE - 0) == 500
#  define __USE_XOPEN_EXTENDED  1
#  define __USE_UNIX98  1
#  undef _LARGEFILE_SOURCE
#  define _LARGEFILE_SOURCE     1
# else
#  ifdef _XOPEN_SOURCE_EXTENDED
#   define __USE_XOPEN_EXTENDED 1
#  endif
# endif
#endif
. . .

and then:

// from unistd.h
. . .
#include <features.h>
. . .
#ifdef __USE_UNIX98
# define _XOPEN_VERSION 500
#else
# define _XOPEN_VERSION 4
#endif


This last #ifdef should be removed and the only way to get __USE_UNIX98 
defined is to define _XOPEN_VERSION to 500 or higher or define 
_GNU_SOURCE prior to including unistd.h
Now is glibc-2.1.1 compliant to _XOPEN_VERSION 500? Can _GNU_SOURCE
be turned on safely?
 

Thanks, Jean-Marie.


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