remove obstack support
[uclibc-ng.git] / libc / signal / sigpause.c
blobde50d98b27c5b817a8eb51263e999e16ce9bb4df
1 /* Copyright (C) 1991,92,94-98,2000,2002,2003,2004
2 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
19 #include <signal.h>
20 #define __need_NULL
21 #include <stddef.h>
22 #include <cancel.h>
24 #include "sigset-cvt-mask.h"
26 /* Set the mask of blocked signals to MASK,
27 wait for a signal to arrive, and then restore the mask. */
28 static int __sigpause (int sig_or_mask, int is_sig)
30 sigset_t set;
32 if (is_sig)
34 /* The modern X/Open implementation is requested. */
35 sigprocmask (SIG_BLOCK, NULL, &set);
36 /* Bound-check sig_or_mask, remove it from the set. */
37 if (sigdelset (&set, sig_or_mask) < 0)
38 return -1;
40 else
41 sigset_set_old_mask (&set, sig_or_mask);
43 /* Note the sigpause() is a cancellation point. But since we call
44 sigsuspend() which itself is a cancellation point we do not have
45 to do anything here. */
46 /* uClibc note: not true on uClibc, we call the non-cancellable version */
47 return __NC(sigsuspend)(&set);
50 int __bsd_sigpause(int mask);
51 int __bsd_sigpause(int mask)
53 return __sigpause(mask, 0);
56 /* We have to provide a default version of this function since the
57 standards demand it. The version which is a bit more reasonable is
58 the BSD version. So make this the default. */
59 static int __NC(sigpause)(int sig)
61 return __sigpause(sig, 1);
63 CANCELLABLE_SYSCALL(int, sigpause, (int sig), (sig))