Most headers that use struct timespec require that it be defined as in <time.h> (<aio.h> line 7210, <mqueue.h> line 9846, <pthread.h> line 10543, <sched.h> line 10756, <signal.h> line 10967, <sys/select.h> line 12650, <sys/stat.h> line 13044).

However, while <semaphore.h> permits the inclusion of <time.h> (line 10892), it does not require it and does not mandate that a forward reference to struct timespec be in place before the declaration of sem_timedwait(), which means that the declaration could be inadvertently declaring a pointer to a unique type if the headers are included in the wrong order. Worse, <trace.h> directly uses struct timespec (line 14264), but does not require either the type to exist nor the use of <time.h>. Both of these go against the goal of Issue 7 in making more headers self-contained.

Finally, a number of functions list the inclusion of <time.h> in their SYNOPSIS section, supposedly to guarantee the correct struct timespec, although this is redundant as demonstrated by the requirements listed above.

Desired Action

After line 10877 (XBD <semaphore.h> DESCRIPTION), add a paragraph:

The <semaphore.h> header shall define the struct timespec structure as described in <time.h>.

After line 14305 (XBD <trace.h> DESCRIPTION), add a paragraph:

The <trace.h> header shall define the struct timespec structure as described in <time.h>.

* Inclusion of <time.h> breaks X/Open and POSIX namespace.
* The timespec structure while allowed in XPG6 and POSIX.1003d-1999,
* is not permitted in prior POSIX or X/Open specifications even
* though functions beginning with sem_* are allowed.