]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/libc/sysdeps/linux/common/pause.c
update
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / libc / sysdeps / linux / common / pause.c
1 /* vi: set sw=4 ts=4: */
2 /*
3  * pause() for uClibc
4  *
5  * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
6  *
7  * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
8  */
9
10 #include <sys/syscall.h>
11 #include <unistd.h>
12 #include <cancel.h>
13
14 #ifdef __NR_pause
15 /* even if it is not obvious, glibc uses the pause syscall, see syscalls.list */
16 # define __NR___pause_nocancel __NR_pause
17 static _syscall0(int, __NC(pause))
18 CANCELLABLE_SYSCALL(int, pause, (void), ())
19 #else
20 # define __need_NULL
21 # include <stddef.h>
22 # include <signal.h>
23
24 int
25 # ifdef __LINUXTHREADS_OLD__
26 weak_function
27 # endif
28 __NC(pause)(void)
29 {
30         sigset_t set;
31
32         /*__sigemptyset (&set); - why? */
33         sigprocmask (SIG_BLOCK, NULL, &set);
34
35         /* pause is a cancellation point, but so is sigsuspend.
36            So no need for anything special here.  */
37         return sigsuspend(&set);
38 }
39 CANCELLABLE_SYSCALL(int, pause, (void), ())
40 LIBC_CANCEL_HANDLED ();         /* sigsuspend handles our cancellation.  */
41 #endif