summaryrefslogtreecommitdiffstats
path: root/libc/sysdeps/linux/common/pause.c
diff options
context:
space:
mode:
authorCarmelo Amoroso <carmelo.amoroso@st.com>2007-11-22 16:09:55 +0000
committerCarmelo Amoroso <carmelo.amoroso@st.com>2007-11-22 16:09:55 +0000
commitf90eda6523848d835adbe7bef598a86a72b1b22a (patch)
treeed6b799ce413dbd67251144be47f7cfe8a5fb746 /libc/sysdeps/linux/common/pause.c
parent0957a1a07cba013759ac2067979e6792f804af90 (diff)
downloaduClibc-alpine-f90eda6523848d835adbe7bef598a86a72b1b22a.tar.bz2
uClibc-alpine-f90eda6523848d835adbe7bef598a86a72b1b22a.tar.xz
Push back changes to add cancellation handling.
It still needs to reach an agreement on the final solution, anyway this code have been put int to be shared for the mips-sh4 merge Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Diffstat (limited to 'libc/sysdeps/linux/common/pause.c')
-rw-r--r--libc/sysdeps/linux/common/pause.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/libc/sysdeps/linux/common/pause.c b/libc/sysdeps/linux/common/pause.c
index 751b6b6a9..74115b281 100644
--- a/libc/sysdeps/linux/common/pause.c
+++ b/libc/sysdeps/linux/common/pause.c
@@ -7,22 +7,25 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define __UCLIBC_HIDE_DEPRECATED__
-#include "syscalls.h"
-#include <unistd.h>
-
-extern __typeof(pause) __libc_pause;
-#ifdef __NR_pause
-#define __NR___libc_pause __NR_pause
-_syscall0(int, __libc_pause);
-#else
#include <signal.h>
-libc_hidden_proto(__sigpause)
-libc_hidden_proto(sigblock)
+#include <unistd.h>
+#include <sysdep-cancel.h>
-int __libc_pause(void)
+/* Suspend the process until a signal arrives.
+ This always returns -1 and sets errno to EINTR. */
+int
+__libc_pause (void)
{
- return (__sigpause(sigblock(0), 0));
+ sigset_t set;
+
+ __sigemptyset (&set);
+ sigprocmask (SIG_BLOCK, NULL, &set);
+
+ /* pause is a cancellation point, but so is sigsuspend.
+ So no need for anything special here. */
+
+ return sigsuspend (&set);
}
-#endif
-weak_alias(__libc_pause,pause)
+weak_alias (__libc_pause, pause)
+
+LIBC_CANCEL_HANDLED (); /* sigsuspend handles our cancellation. */