From patchwork Tue May 23 16:12:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 20545 Received: (qmail 95002 invoked by alias); 23 May 2017 16:12:18 -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 94986 invoked by uid 89); 23 May 2017 16:12:18 -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: Tue, 23 May 2017 16:12:10 +0000 From: Joseph Myers To: Subject: Fix sigstack namespace (bug 21511) 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-04.mgc.mentorg.com (139.181.222.4) The sigstack function was removed in the 2001 edition of POSIX, and the sigstack structure in the 2008 edition. signal.h wrongly includes those declarations even for newer POSIX versions. This patch fixes the conditions, and conform/ expectations, accordingly. This patch makes the minimum change to when these declarations are present, leaving them visible for __USE_MISC as they would previously have been visible by default. Arguably these legacy declarations should only be visible when an old standard is specifically requested, but implementing that would require arranging for the various sigstack implementations to be able to see the struct sigstack type despite it not being in _GNU_SOURCE in that case. Tested for x86_64. 2017-05-23 Joseph Myers [BZ #21511] * signal/signal.h: Include only if [(__USE_XOPEN_EXTENDED && !__USE_XOPEN2K8) || __USE_MISC]. (sigstack): Declare only if [(__USE_XOPEN_EXTENDED && !__USE_XOPEN2K) || __USE_MISC]. * conform/data/signal.h-data (struct sigstack): Expect type only if [!XOPEN2K8 && !POSIX2008]. (sigstack): Expect function only if [XPG42 || UNIX98]. diff --git a/conform/data/signal.h-data b/conform/data/signal.h-data index 3651e86..8fbe3ac 100644 --- a/conform/data/signal.h-data +++ b/conform/data/signal.h-data @@ -141,10 +141,12 @@ element stack_t {void*} ss_sp element stack_t size_t ss_size element stack_t int ss_flags +# if !defined XOPEN2K8 && !defined POSIX2008 type {struct sigstack} element {struct sigstack} int ss_onstack element {struct sigstack} {void*} ss_sp +# endif # endif # ifndef XPG4 @@ -249,7 +251,7 @@ function int sigqueue (pid_t, int, const union sigval) function int sigrelse (int) function void (*sigset (int, void(*)(int)))(int) # endif -# if !defined POSIX +# if defined XPG42 || defined UNIX98 function int sigstack (struct sigstack*, struct sigstack*) # endif function int sigsuspend (const sigset_t*) diff --git a/signal/signal.h b/signal/signal.h index a51e912..947873e 100644 --- a/signal/signal.h +++ b/signal/signal.h @@ -297,7 +297,6 @@ extern int sigreturn (struct sigcontext *__scp) __THROW; extern int siginterrupt (int __sig, int __interrupt) __THROW; # include -# include # include # include # if defined __USE_XOPEN || defined __USE_XOPEN2K8 @@ -305,12 +304,6 @@ extern int siginterrupt (int __sig, int __interrupt) __THROW; # include # endif -/* Run signals handlers on the stack specified by SS (if not NULL). - If OSS is not NULL, it is filled in with the old signal stack status. - This interface is obsolete and on many platform not implemented. */ -extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) - __THROW __attribute_deprecated__; - /* Alternate signal handler stack interface. This interface should always be preferred over `sigstack'. */ extern int sigaltstack (const struct sigaltstack *__restrict __ss, @@ -318,6 +311,20 @@ extern int sigaltstack (const struct sigaltstack *__restrict __ss, #endif /* Use POSIX.1-2008 or X/Open Unix. */ +#if ((defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \ + || defined __USE_MISC) +# include +#endif + +#if ((defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K) \ + || defined __USE_MISC) +/* Run signals handlers on the stack specified by SS (if not NULL). + If OSS is not NULL, it is filled in with the old signal stack status. + This interface is obsolete and on many platform not implemented. */ +extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) + __THROW __attribute_deprecated__; +#endif + #ifdef __USE_XOPEN_EXTENDED /* Simplified interface for signal management. */