NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: sys/types.h header file Issue



Hi,

2009/11/13 Thor Lancelot Simon <tls%panix.com@localhost>:
> On Fri, Nov 13, 2009 at 06:00:01PM +0530, Channa wrote:
>>
>> What is the reason for including <pthread_types.h> under the macros
>> '_POSIX_C_SOURCE'
>> or '_XOPEN_SOURCE' ?
>>
>> Since the IEEE specification for <sys/types.h> below does not mention
>> such a rule
>>
>> http://www.opengroup.org/onlinepubs/000095399/basedefs/sys/types.h.html#tag_13_67
>>
>> Is it ok to move the inclusion of <pthread_types.h> outside these macros?
>
> No, it is not.  The reason the inclusion is conditional on Posix/XOpen
> version is because the types declared in pthread_types.h constitute
> namespace pollution according to the older standard, which did not describe
> them.
>
> Are you trying to build something that sets POSIX_C_SOURCE to a very small
> value?

I have declared prototype of pthread_kill() in the <signal.h>
header file as per the IEEE specification of pthread_kill() link given
below:

http://www.opengroup.org/onlinepubs/009695399/functions/pthread_kill.html

And the data type 'pthread_t' is exposed to <signal.h> through <sys/types.h>
which includes <pthread_types.h> with the following macros as given below:

$ cat src/sys/sys/types.h
:
#if (_POSIX_C_SOURCE - 0L) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
    defined(_NETBSD_SOURCE)
#include <pthread_types.h>
#endif
:

When i am building my application i get compilation error at
'pthread_t' data type
since the application does not define any of the macros '_POSIX_C_SOURCE'
or '_XOPEN_SOURCE' or '_NETBSD_SOURCE'. and the pthread data types
are not getting included in <signal.h> header file.


So to solve this build break in the application is it mandatory to define
any of the above said macros? or Modify the header file <sys/types.h> to
avoid such error?

Thanks & Regards,
Channa


Home | Main Index | Thread Index | Old Index