From: Rich Felker Date: Sat, 9 Nov 2013 05:04:02 +0000 (-0500) Subject: adjust sys/wait.h not to produde errors in strict ISO C feature profile X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=f5980e330a331b83f99a25c522aae00170dff131;p=musl adjust sys/wait.h not to produde errors in strict ISO C feature profile siginfo_t is not available from signal.h when the strict ISO C feature profile (e.g. passing -std=c99 to gcc without defining any other feature test macros) is used, but the type is needed to declare waitid. using sys/wait.h (or any POSIX headers) in strict ISO C mode is an application bug, but in the interest of compatibility, it's best to avoid producing gratuitous errors. the simplest fix I could find is suppressing the declaration of waitid (and also signal.h inclusion, since it's not needed for anything else) in this case, while still exposing everything else in sys/wait.h --- diff --git a/include/sys/wait.h b/include/sys/wait.h index a7ad7cd1..c794f5d3 100644 --- a/include/sys/wait.h +++ b/include/sys/wait.h @@ -6,8 +6,6 @@ extern "C" { #include -#include - #define __NEED_pid_t #define __NEED_id_t #include @@ -19,9 +17,15 @@ typedef enum { } idtype_t; pid_t wait (int *); -int waitid (idtype_t, id_t, siginfo_t *, int); pid_t waitpid (pid_t, int *, int ); +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ + || defined(_BSD_SOURCE) +#include +int waitid (idtype_t, id_t, siginfo_t *, int); +#endif + #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #include pid_t wait3 (int *, int, struct rusage *);