signal: Deprecate additional legacy signal handling functions
Commit Message
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(-)
Comments
* Florian Weimer:
> 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.
I think we should deprecate the sigmask macro as well, so I'm going to
post a revised patch.
Thanks,
Florian
@@ -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:
@@ -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);
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
+#include <support/xsignal.h>
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)
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
+#include <support/xsignal.h>
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)
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
+#include <support/xsignal.h>
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)
@@ -22,17 +22,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-
+#include <support/xsignal.h>
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);
@@ -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)
@@ -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
@@ -10,6 +10,9 @@
#include <sys/types.h>
#include <sys/wait.h>
+/* The sigset function is deprecated. */
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
#define TEST_SIG SIGINT
@@ -21,6 +21,8 @@
#include <stdio.h>
#include <string.h>
+/* The sighold and sigrelse functions are deprecated. */
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
static int
do_test (void)