From 02802fafcf6e11ea3f998f685035ffe568dfddeb Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Mon, 25 May 2020 18:32:28 +0200 Subject: 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 --- signal/signal.h | 23 ++++++++++++++++------- signal/tst-sigset2.c | 4 ++++ signal/tst-sigsimple.c | 3 +++ 3 files changed, 23 insertions(+), 7 deletions(-) (limited to 'signal') 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 # include @@ -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 #include #include +#include + +/* 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 #include #include +#include +/* The sighold and sigrelse functions are deprecated. */ +DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations"); static int do_test (void) -- cgit 1.4.1