aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/not-cancel.h2
-rw-r--r--sysdeps/posix/pause.c15
-rw-r--r--sysdeps/unix/sysv/linux/not-cancel.h10
-rw-r--r--sysdeps/unix/sysv/linux/pause.c13
4 files changed, 15 insertions, 25 deletions
diff --git a/sysdeps/generic/not-cancel.h b/sysdeps/generic/not-cancel.h
index 3f924c8..f2140c2 100644
--- a/sysdeps/generic/not-cancel.h
+++ b/sysdeps/generic/not-cancel.h
@@ -38,7 +38,7 @@
(void) __writev (fd, iov, n)
# define __waitpid_nocancel(pid, stat_loc, options) \
__waitpid (pid, stat_loc, options)
-#define pause_not_cancel() \
+#define __pause_nocancel() \
__pause ()
#define nanosleep_not_cancel(requested_time, remaining) \
__nanosleep (requested_time, remaining)
diff --git a/sysdeps/posix/pause.c b/sysdeps/posix/pause.c
index 7996cd6..53e143d 100644
--- a/sysdeps/posix/pause.c
+++ b/sysdeps/posix/pause.c
@@ -39,18 +39,3 @@ __libc_pause (void)
weak_alias (__libc_pause, pause)
LIBC_CANCEL_HANDLED (); /* sigsuspend handles our cancellation. */
-
-#ifndef NO_CANCELLATION
-# include <not-cancel.h>
-
-int
-__pause_nocancel (void)
-{
- sigset_t set;
-
- __sigemptyset (&set);
- __sigprocmask (SIG_BLOCK, NULL, &set);
-
- return sigsuspend_not_cancel (&set);
-}
-#endif
diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h
index c4a60b8..ac78cb3 100644
--- a/sysdeps/unix/sysv/linux/not-cancel.h
+++ b/sysdeps/unix/sysv/linux/not-cancel.h
@@ -77,14 +77,8 @@ __typeof (waitpid) __waitpid_nocancel;
libc_hidden_proto (__waitpid_nocancel)
/* Uncancelable pause. */
-#define pause_not_cancel() \
- ({ sigset_t set; \
- int __rc = INLINE_SYSCALL (rt_sigprocmask, 4, SIG_BLOCK, NULL, &set, \
- _NSIG / 8); \
- if (__rc == 0) \
- __rc = INLINE_SYSCALL (rt_sigsuspend, 2, &set, _NSIG / 8); \
- __rc; \
- })
+__typeof (pause) __pause_nocancel;
+libc_hidden_proto (__pause_nocancel)
/* Uncancelable nanosleep. */
#define nanosleep_not_cancel(requested_time, remaining) \
diff --git a/sysdeps/unix/sysv/linux/pause.c b/sysdeps/unix/sysv/linux/pause.c
index 4ccce9e..3300eb8 100644
--- a/sysdeps/unix/sysv/linux/pause.c
+++ b/sysdeps/unix/sysv/linux/pause.c
@@ -19,10 +19,10 @@
#include <signal.h>
#include <unistd.h>
#include <sysdep-cancel.h>
+#include <not-cancel.h>
/* Suspend the process until a signal arrives.
This always returns -1 and sets errno to EINTR. */
-
int
__libc_pause (void)
{
@@ -33,3 +33,14 @@ __libc_pause (void)
#endif
}
weak_alias (__libc_pause, pause)
+
+int
+__pause_nocancel (void)
+{
+#ifdef __NR_pause
+ return INLINE_SYSCALL_CALL (pause);
+#else
+ return INLINE_SYSCALL_CALL (ppoll, NULL, 0, NULL, NULL);
+#endif
+}
+libc_hidden_def (__pause_nocancel)