From patchwork Fri Jun 9 03:19:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 20875 Received: (qmail 86399 invoked by alias); 9 Jun 2017 03:19:58 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 61955 invoked by uid 89); 9 Jun 2017 03:19:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy= X-HELO: relay1.mentorg.com Date: Fri, 9 Jun 2017 03:19:34 +0000 From: Joseph Myers To: Subject: Condition signal.h inclusion in sys/wait.h (bug 21560) Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) sys/wait.h includes signal.h unconditionally. But the permission to do so is UX-shaded in XPG4.2, and XSI-shaded in POSIX before 2008, so this should not be unconditional. This patch fixes this conservatively: the include is kept, but conditioned on the standards that permit it (meaning it is still present by default, because non-XSI POSIX.1:2008 is enabled by default). is now included unconditionally to provide the required definition of __pid_t; it was previously included via . Some standards require pid_t to be defined here, and all allow it to be defined here; previously defined via , it's now defined directly in this header. Tested for x86_64. This does not fix any of the sys/wait.h conformtest failures, but substantially reduces the number of namespace failures for sys/wait.h for XPG4 and POSIX. 2017-06-09 Joseph Myers [BZ #21560] * posix/sys/wait.h: Condition include of on [__USE_XOPEN_EXTENDED || __USE_XOPEN2K8]. Include unconditionally. [!__pid_t_defined] (pid_t): Define typedef. diff --git a/posix/sys/wait.h b/posix/sys/wait.h index d5b7e4d..909979b 100644 --- a/posix/sys/wait.h +++ b/posix/sys/wait.h @@ -26,7 +26,15 @@ __BEGIN_DECLS -#include +#include +#ifndef __pid_t_defined +typedef __pid_t pid_t; +# define __pid_t_defined +#endif + +#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 +# include +#endif /* These macros could also be defined in . */ #if !defined _STDLIB_H || (!defined __USE_XOPEN && !defined __USE_XOPEN2K8) @@ -98,7 +106,6 @@ extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options); #if defined __USE_XOPEN || defined __USE_XOPEN2K8 # ifndef __id_t_defined -# include typedef __id_t id_t; # define __id_t_defined # endif