kern/181439: [headers] sys/wait.h is not enough to use waitid(), but kind of should be.

Bruce Evans brde at optusnet.com.au
Thu Aug 22 11:07:37 UTC 2013


On Wed, 21 Aug 2013, Jilles Tjoelker wrote:

> In PR kern/181439, you wrote:
> > [<sys/wait.h> does not define siginfo_t]
>
> POSIX says that <sys/wait.h> shall define siginfo_t and may make visible
> all symbols from <signal.h>.

This was even in the 2001 version (under an XSI extension) (waitid was
there too).

It has other bugs like requiring struct rusage (for wait3() and wait4()
in <sys/wait.h>.  I think struct rusage is a BSD extension.  BSD never
declared struct rusage in <sys/wait.h>.

FreeBSD was compatible with POSIX in 2001 because these bugs were only
in the XSI part.

> This means that POSIX requires the application to #include <signal.h>
> explicitly if it wants to use the constants like SIGCHLD and CLD_EXITED.
> Therefore, I expect most applications to need an explicit #include
> <signal.h> anyway.
>
> To minimize namespace pollution, it would be best to create a new header
> that defines siginfo_t and include it from <signal.h> and <sys/wait.h>,
> or to duplicate the definition.
>
> Adding the #include to <sys/wait.h> would be simpler. If this is the way
> it should work, then it would be best to try to change POSIX to allow

It's simpler and more broken to specify that every header shall include
every header.  "May make visible" is of almost equally low quality, since
it allows simpler implementations without simplifing applications.

Bruce


More information about the freebsd-bugs mailing list