]> sourceware.org Git - glibc.git/commitdiff
Cleanup sigpause implementation
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 3 Nov 2017 12:55:09 +0000 (10:55 -0200)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 15 Nov 2017 17:45:39 +0000 (15:45 -0200)
This patch simplify sigpause by remobing the single thread optimization
since it will be handled already by the __sigsuspend call.

Checked on x86_64-linux-gnu.

* sysdeps/posix/sigpause.c (do_sigpause): Remove.
(__sigpause): Rely on __sigsuspend to implement single thread
optimization.  Add LIBC_CANCEL_HANDLED for cancellation marking.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Zack Weinberg <zackw@panix.com>
ChangeLog
sysdeps/posix/sigpause.c

index b63fa4f77fc495118fcee8040dec8cf4b1e6c4ad..6f10dd94fbf6b0008c21c863850c274529fe2890 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-11-15  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
+
+       * sysdeps/posix/sigpause.c (do_sigpause): Remove.
+       (__sigpause): Rely on __sigsuspend to implement single thread
+       optimization.  Add LIBC_CANCEL_HANDLED for cancellation marking.
+
 2017-11-15  Joseph Myers  <joseph@codesourcery.com>
 
        * scripts/build-many-glibcs.py (Context.checkout): Default Linux
index 9038ed368d063eff40b63566f51b74529378707a..a61e056d24dcc2ef347fae6be7e9aec07a2e0e42 100644 (file)
 #include <errno.h>
 #include <signal.h>
 #include <stddef.h>            /* For NULL.  */
-#include <sysdep-cancel.h>
 #undef sigpause
 
 #include <sigset-cvt-mask.h>
+#include <sysdep-cancel.h>
 
-/* Set the mask of blocked signals to MASK,
-   wait for a signal to arrive, and then restore the mask.  */
-static int
-do_sigpause (int sig_or_mask, int is_sig)
+int
+__sigpause (int sig_or_mask, int is_sig)
 {
   sigset_t set;
 
@@ -46,21 +44,6 @@ do_sigpause (int sig_or_mask, int is_sig)
      to do anything here.  */
   return __sigsuspend (&set);
 }
-
-int
-__sigpause (int sig_or_mask, int is_sig)
-{
-  if (SINGLE_THREAD_P)
-    return do_sigpause (sig_or_mask, is_sig);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int result = do_sigpause (sig_or_mask, is_sig);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-}
 libc_hidden_def (__sigpause)
 
 /* We have to provide a default version of this function since the
@@ -87,3 +70,6 @@ __xpg_sigpause (int sig)
   return __sigpause (sig, 1);
 }
 strong_alias (__xpg_sigpause, __libc___xpg_sigpause)
+
+/* __sigsuspend handles cancellation.  */
+LIBC_CANCEL_HANDLED ();
This page took 0.085095 seconds and 5 git commands to generate.