about summary refs log tree commit diff
path: root/signal
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2020-05-25 18:32:28 +0200
committerFlorian Weimer <fweimer@redhat.com>2020-05-25 18:32:28 +0200
commit02802fafcf6e11ea3f998f685035ffe568dfddeb (patch)
tree2db187fc4bd2ef24a0c70c573b278a5e7ece62e5 /signal
parentde42613540de8d3d70b5f14a14923cab7bd694d0 (diff)
downloadglibc-02802fafcf6e11ea3f998f685035ffe568dfddeb.tar.gz
glibc-02802fafcf6e11ea3f998f685035ffe568dfddeb.tar.xz
glibc-02802fafcf6e11ea3f998f685035ffe568dfddeb.zip
signal: Deprecate additional legacy signal handling functions
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, and for the sigmask deprecation,
-Wno-error.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'signal')
-rw-r--r--signal/signal.h23
-rw-r--r--signal/tst-sigset2.c4
-rw-r--r--signal/tst-sigsimple.c3
3 files changed, 23 insertions, 7 deletions
diff --git a/signal/signal.h b/signal/signal.h
index 40825e95ec..2c57f90e20 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.  */
@@ -164,7 +165,9 @@ extern int __sigpause (int __sig_or_mask, int __is_sig);
    simply do not work in many situations.  Use `sigprocmask' instead.  */
 
 /* Compute mask for signal SIG.  */
-# define sigmask(sig) ((int)(1u << ((sig) - 1)))
+# define sigmask(sig) \
+  __glibc_macro_warning ("sigmask is deprecated") \
+  ((int)(1u << ((sig) - 1)))
 
 /* Block signals in MASK, returning the old mask.  */
 extern int sigblock (int __mask) __THROW __attribute_deprecated__;
@@ -311,7 +314,8 @@ extern int sigreturn (struct sigcontext *__scp) __THROW;
 /* If INTERRUPT is nonzero, make signal SIG interrupt system calls
    (causing them to fail with EINTR); if INTERRUPT is zero, make system
    calls be restarted after signal SIG.  */
-extern int siginterrupt (int __sig, int __interrupt) __THROW;
+extern int siginterrupt (int __sig, int __interrupt) __THROW
+  __attribute_deprecated_msg__ ("Use sigaction with SA_RESTART instead");
 
 # include <bits/sigstack.h>
 # include <bits/ss_flags.h>
@@ -340,16 +344,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..4eef653f95 100644
--- a/signal/tst-sigset2.c
+++ b/signal/tst-sigset2.c
@@ -9,6 +9,10 @@
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/wait.h>
+#include <libc-diag.h>
+
+/* The sigset function is deprecated.  */
+DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
 
 #define TEST_SIG SIGINT
 
diff --git a/signal/tst-sigsimple.c b/signal/tst-sigsimple.c
index d0e6b2f340..56202348bc 100644
--- a/signal/tst-sigsimple.c
+++ b/signal/tst-sigsimple.c
@@ -20,7 +20,10 @@
 #include <signal.h>
 #include <stdio.h>
 #include <string.h>
+#include <libc-diag.h>
 
+/* The sighold and sigrelse functions are deprecated.  */
+DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
 
 static int
 do_test (void)