about summary refs log tree commit diff
path: root/nptl
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 /nptl
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 'nptl')
-rw-r--r--nptl/Makefile7
-rw-r--r--nptl/tst-cancel4.c7
-rw-r--r--nptl/tst-exec1.c7
-rw-r--r--nptl/tst-exec2.c7
-rw-r--r--nptl/tst-exec3.c7
-rw-r--r--nptl/tst-exec4.c8
-rw-r--r--nptl/tst-exec5.c6
7 files changed, 23 insertions, 26 deletions
diff --git a/nptl/Makefile b/nptl/Makefile
index e5686b20ac..587b241367 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -510,6 +510,13 @@ endif
 # function frequently to get a thread-specific handle.
 CFLAGS-pthread_self.os += -fomit-frame-pointer
 
+# The sigmask macro is deprecated and triggers are compiler warning
+# which cannot be suppressed (as of GCC 9).
+CFLAGS-tst-cancel4.c += -Wno-error
+CFLAGS-tst-cancel5.c += -Wno-error
+CFLAGS-tst-cancelx4.c += -Wno-error
+CFLAGS-tst-cancelx5.c += -Wno-error
+
 # Run the cancellation and cleanup tests also for the modern, exception-based
 # implementation.  For this we have to pass the -fexceptions parameter.
 CFLAGS-tst-cancelx2.c += -fexceptions
diff --git a/nptl/tst-cancel4.c b/nptl/tst-cancel4.c
index 652668537a..be7a48e253 100644
--- a/nptl/tst-cancel4.c
+++ b/nptl/tst-cancel4.c
@@ -39,6 +39,7 @@
 #include <sys/wait.h>
 #include <sys/stat.h>
 #include <sys/uio.h>
+#include <libc-diag.h>
 
 
 /* Since STREAMS are not supported in the standard Linux kernel and
@@ -527,7 +528,13 @@ tf_sigpause (void *arg)
 
   pthread_cleanup_push (cl, NULL);
 
+  /* This tests the deprecated sigpause and sigmask functions.  The
+     file is compiled with -Wno-errno so that the sigmask deprecation
+     warning is not fatal.  */
+  DIAG_PUSH_NEEDS_COMMENT;
+  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
   sigpause (sigmask (SIGINT));
+  DIAG_POP_NEEDS_COMMENT;
 
   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 <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)
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 <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)
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 <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)
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 <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);
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)