Subject: standards, pthread symbols, and headers
To: None <>
From: Nathan J. Williams <>
List: tech-userlevel
Date: 07/16/2003 17:48:11
I've started trying to move some of the pthread definitions and
symbols out of <pthread.h>, where it was convenient to put them while
there was a branch, and into the headers that the standards want them in.
A couple of things have come up that I'd like advice on.

The first one is that the pthread_*_t types are supposed to be defined
in <sys/types.h>. Fortunately, the types are encapsulated into their
own header already; would it be okay to add:

#if !defined(_KERNEL)
#include <pthread_types.h>

to <sys/types.h>? What level of feature-test protection should it get?
I'm also somewhat concerned that this exposes the symbols too widely,
since lots of other headers include <sys/types.h>.

Next, I was looking for a place to put PTHREAD_DESTRUCTOR_ITERATIONS
and PTHREAD_KEYS_MAX such that the values end up in <limits.h>, and
couldn't see a good spot of prior art for actual limit values, as
opposed to minimum values... along the way, I also noticed that
<limits.h> defines a lot of _POSIX_* symbols for minimum values. SUSv3
claims those should be in <unistd.h>, and <limits.h> should have the
actual limit, if any, rather than the minimums. Are they in the wrong
place, or am I missing something?

Finally, there are a bunch of pthread-related sysconf() variables
relating to feature-testing and limits. Is the correct approach to
define a CTL_USER sysctl for each _SC_* symbol and glue all the cases
into sysconf.c and sysctl.c in libc?

        - Nathan