From patchwork Mon Feb 24 19:07:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 1243435 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-110049-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha1 header.s=default header.b=jhC54ASn; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=RMffkdlL; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48RBQp3Ykfz9sP7 for ; Tue, 25 Feb 2020 06:07:46 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=laR OpB93ZduUqUZoqGNGK9cDS4OdvNzMaqptsXV7EiOfQBaKXRXN/jyaW2JkNr3u1s7 /1kfsBfj0diFU23Grs+r2gNDkitLE5jcqcTORbjeGaD/+J2J5ZPPCYF4FSNsb+6W ATc5/FqQHEyGP0t56QhRRfGgTXGSxhfn2uPmfc4A= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type:content-transfer-encoding; s=default; bh=PT0A44OiR y47dO29j9o2lxi/AOA=; b=jhC54ASnFEiSi4hM3yVMeoc8Lc4/sOkuWMxbtauZi Hk2ePoZFV8d0VR8pVptoib+/5DmQl1imynTbFOYr7GqeY7aAYpw68T3LLJBsV9xc xm2L0Al3ID9uB6exmVHTZ+8YncNOGl/iFBXDGagmnKzQUOXhthmlLqyOENoc4E7L 3U= Received: (qmail 13519 invoked by alias); 24 Feb 2020 19:07:40 -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 13507 invoked by uid 89); 24 Feb 2020 19:07:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=suspend X-HELO: us-smtp-1.mimecast.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582571257; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RK7+e147EZamxUlB16eR8Lnv08vKTnqg5N/BD04LRfM=; b=RMffkdlLSThRiozcApQd6wLSy0gusHWh8h7fYHh0OwVE01jhhrNxjklCysVX8d6ie1qG67 K4lu1MgRMzvpJz7d2dmu8A6F5KtErlqN7ywjHKYEy7frwATTJ8A8IEbCHwhE+Bzdvr4UAT 24wHNCsfFMRyRwav5EFYs/+GsS2GZo4= From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH] signal: Deprecate additional legacy signal handling functions Date: Mon, 24 Feb 2020 20:07:32 +0100 Message-ID: <87lforn6rv.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com This needs a few test adjustments: In some cases, sigignore was used for convenience (replaced with xsignal with SIG_IGN). Tests for the deprecated functions need to disable -Wdeprecated-declarations. ----- NEWS | 4 +++- nptl/tst-cancel4.c | 3 +++ nptl/tst-exec1.c | 7 ++----- nptl/tst-exec2.c | 7 ++----- nptl/tst-exec3.c | 7 ++----- nptl/tst-exec4.c | 8 ++------ nptl/tst-exec5.c | 6 +----- signal/signal.h | 16 +++++++++++----- signal/tst-sigset2.c | 3 +++ signal/tst-sigsimple.c | 2 ++ 10 files changed, 31 insertions(+), 32 deletions(-) diff --git a/NEWS b/NEWS index 77631ca707..0b231bfa8e 100644 --- a/NEWS +++ b/NEWS @@ -13,7 +13,9 @@ Major new features: Deprecated and removed features, and other changes affecting compatibility: - [Add deprecations, removals and changes affecting compatibility here] +* The legacy signal handling functions sigpause, sighold, sigrelse, + sigignore and sigset have been deprecated. Applications should use + the sigsuspend, sigprocmask and sigaction functions instead. Changes to build and runtime requirements: diff --git a/nptl/tst-cancel4.c b/nptl/tst-cancel4.c index 652668537a..5f284a62a7 100644 --- a/nptl/tst-cancel4.c +++ b/nptl/tst-cancel4.c @@ -527,7 +527,10 @@ tf_sigpause (void *arg) pthread_cleanup_push (cl, NULL); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" sigpause (sigmask (SIGINT)); +#pragma GCC diagnostic pop pthread_cleanup_pop (0); diff --git a/nptl/tst-exec1.c b/nptl/tst-exec1.c index e1a5baa41f..892107d4c7 100644 --- a/nptl/tst-exec1.c +++ b/nptl/tst-exec1.c @@ -27,6 +27,7 @@ #include #include #include +#include static void * @@ -56,11 +57,7 @@ do_test (void) } /* Not interested in knowing when the pipe is closed. */ - if (sigignore (SIGPIPE) != 0) - { - puts ("sigignore failed"); - exit (1); - } + xsignal (SIGPIPE, SIG_IGN); posix_spawn_file_actions_t a; if (posix_spawn_file_actions_init (&a) != 0) diff --git a/nptl/tst-exec2.c b/nptl/tst-exec2.c index 3d3fb430bf..f57903da1e 100644 --- a/nptl/tst-exec2.c +++ b/nptl/tst-exec2.c @@ -27,6 +27,7 @@ #include #include #include +#include static void * @@ -56,11 +57,7 @@ do_test (void) } /* Not interested in knowing when the pipe is closed. */ - if (sigignore (SIGPIPE) != 0) - { - puts ("sigignore failed"); - exit (1); - } + xsignal (SIGPIPE, SIG_IGN); pid_t pid = fork (); if (pid == -1) diff --git a/nptl/tst-exec3.c b/nptl/tst-exec3.c index 8a018e916e..b849d3aef7 100644 --- a/nptl/tst-exec3.c +++ b/nptl/tst-exec3.c @@ -27,6 +27,7 @@ #include #include #include +#include static void * @@ -50,11 +51,7 @@ do_test (void) } /* Not interested in knowing when the pipe is closed. */ - if (sigignore (SIGPIPE) != 0) - { - puts ("sigignore failed"); - exit (1); - } + xsignal (SIGPIPE, SIG_IGN); pid_t pid = fork (); if (pid == -1) diff --git a/nptl/tst-exec4.c b/nptl/tst-exec4.c index cf5998219b..2f32389f41 100644 --- a/nptl/tst-exec4.c +++ b/nptl/tst-exec4.c @@ -22,17 +22,13 @@ #include #include #include - +#include static void * tf (void *arg) { /* Ignore SIGUSR1 and block SIGUSR2. */ - if (sigignore (SIGUSR1) != 0) - { - puts ("sigignore failed"); - exit (1); - } + xsignal (SIGUSR1, SIG_IGN); sigset_t ss; sigemptyset (&ss); diff --git a/nptl/tst-exec5.c b/nptl/tst-exec5.c index 02628931c8..c77f856263 100644 --- a/nptl/tst-exec5.c +++ b/nptl/tst-exec5.c @@ -86,11 +86,7 @@ do_test (void) } /* Not interested in knowing when the pipe is closed. */ - if (sigignore (SIGPIPE) != 0) - { - puts ("error: sigignore failed"); - exit (1); - } + xsignal (SIGPIPE, SIG_IGN); /* To synchronize with the thread. */ if (pthread_barrier_init (&b, NULL, 2) != 0) diff --git a/signal/signal.h b/signal/signal.h index 40825e95ec..f43876c9dc 100644 --- a/signal/signal.h +++ b/signal/signal.h @@ -148,7 +148,8 @@ extern void psiginfo (const siginfo_t *__pinfo, const char *__s); #ifdef __USE_XOPEN_EXTENDED # ifdef __GNUC__ -extern int sigpause (int __sig) __asm__ ("__xpg_sigpause"); +extern int sigpause (int __sig) __asm__ ("__xpg_sigpause") + __attribute_deprecated_msg__ ("Use the sigsuspend function instead"); # else extern int __sigpause (int __sig_or_mask, int __is_sig); /* Remove a signal from the signal mask and suspend the process. */ @@ -340,16 +341,21 @@ extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) /* Simplified interface for signal management. */ /* Add SIG to the calling process' signal mask. */ -extern int sighold (int __sig) __THROW; +extern int sighold (int __sig) __THROW + __attribute_deprecated_msg__ ("Use the sigprocmask function instead"); /* Remove SIG from the calling process' signal mask. */ -extern int sigrelse (int __sig) __THROW; +extern int sigrelse (int __sig) __THROW + __attribute_deprecated_msg__ ("Use the sigprocmask function instead"); /* Set the disposition of SIG to SIG_IGN. */ -extern int sigignore (int __sig) __THROW; +extern int sigignore (int __sig) __THROW + __attribute_deprecated_msg__ ("Use the signal function instead"); /* Set the disposition of SIG. */ -extern __sighandler_t sigset (int __sig, __sighandler_t __disp) __THROW; +extern __sighandler_t sigset (int __sig, __sighandler_t __disp) __THROW + __attribute_deprecated_msg__ + ("Use the signal and sigprocmask functions instead"); #endif #if defined __USE_POSIX199506 || defined __USE_UNIX98 diff --git a/signal/tst-sigset2.c b/signal/tst-sigset2.c index f653323321..32a4cfff5d 100644 --- a/signal/tst-sigset2.c +++ b/signal/tst-sigset2.c @@ -10,6 +10,9 @@ #include #include +/* The sigset function is deprecated. */ +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #define TEST_SIG SIGINT diff --git a/signal/tst-sigsimple.c b/signal/tst-sigsimple.c index d0e6b2f340..cbdd1739ad 100644 --- a/signal/tst-sigsimple.c +++ b/signal/tst-sigsimple.c @@ -21,6 +21,8 @@ #include #include +/* The sighold and sigrelse functions are deprecated. */ +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" static int do_test (void)