Date: Sat, 20 Aug 2005 00:04:56 +1000 (EST) From: Bruce Evans <bde@zeta.org.au> To: Stefan Farfeleder <stefanf@FreeBSD.org> Cc: standards@FreeBSD.org Subject: Re: <pthread.h> includes Message-ID: <20050819231640.E2640@epsplex.bde.org> In-Reply-To: <20050819093649.GU21905@wombat.fafoe.narf.at> References: <20050819093649.GU21905@wombat.fafoe.narf.at>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 19 Aug 2005, Stefan Farfeleder wrote: > I think some of the headers included by <pthread.h> violate the POSIX > specification (I'm looking at SUSv3/POSIX 1003.1 2004) by making more > symbols visible than allowed. > > <sys/cdefs.h> Ok > <sys/types.h> Ok > <sys/_pthreadtypes.h> Ok > <sys/time.h> No? (POSIX allows <time.h> which is a subset) > <sys/signal.h> No? > <limits.h> No? > <sched.h> Ok > > Is this correct? Should it be fixed? All of these includes except <sys/cdefs.h> and <sys/pthreadtypes.h> are wrong IMO: <sys/cdefs.h> needed, but can be obtained as a side effect of including almost any other header in the list. <sys/types.h> only used to declare size_t. We handle this better in many other headers. The old draft of POSIX that I'm looking at doesn't say that <pthread.h> declares size_t, so it might be conformant to use __size_t in the prototypes. <sys/_pthreadtypes.h> Ok <sys/time.h> only used to declare sigset_t and struct timespec. We have a whole header, <sys/_sigset.h>, to help declare sigset_t better (it only declares __sigset_t), and use it in many other headers. We have 2 headers, <sys/timespec.h> and <sys/_timespec.h>, just to declare struct timespec, and use them in many other headers. Here we only need a forward declaration of struct timespec or maybe struct __timespec, modulo POSIX bugs. It is a bug in POSIX that <time.h> is allowed. The old draft of POSIX doesn't say that <pthread.h> declares sigset_t or struct timespec (just that it may declare the latter). This is unlike what it says for other headers. E.g., we use <sys/timespec.h> in <sys/select.h> to satisfy the POSIX mistake that a complete struct timespec must be declared there. <sys/signal.h> Just namespace pollution. <limits.h> Just namespace pollution. <sched.h> only used to declare struct sched_param and to satisfy a POSIX mistake. A forward declaration would suffice. POSIX should say that size_t, sigset_t and struct timespec are completely declared, and then it would say that [low quality] implementations may declare everything else in the primary headers that declare these. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050819231640.E2640>