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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 #define __UCLIBC_HIDE_DEPRECATED__
21 /* psm: need the BSD version of sigpause here */
25 #include <stddef.h> /* For NULL. */
26 #ifdef __UCLIBC_HAS_THREADS_NATIVE__
27 #include <sysdep-cancel.h>
30 #include "sigset-cvt-mask.h"
32 /* Set the mask of blocked signals to MASK,
33 wait for a signal to arrive, and then restore the mask. */
34 int __sigpause (int sig_or_mask, int is_sig)
40 /* The modern X/Open implementation is requested. */
41 sigprocmask (SIG_BLOCK, NULL, &set);
42 /* Bound-check sig_or_mask, remove it from the set. */
43 if (sigdelset (&set, sig_or_mask) < 0)
47 sigset_set_old_mask (&set, sig_or_mask);
49 /* Note the sigpause() is a cancellation point. But since we call
50 sigsuspend() which itself is a cancellation point we do not have
51 to do anything here. */
52 return sigsuspend (&set);
54 libc_hidden_def(__sigpause)
58 /* We have to provide a default version of this function since the
59 standards demand it. The version which is a bit more reasonable is
60 the BSD version. So make this the default. */
61 int sigpause (int mask)
63 #ifdef __UCLIBC_HAS_THREADS_NATIVE__
65 return __sigpause (mask, 0);
67 int oldtype = LIBC_CANCEL_ASYNC ();
69 int result = __sigpause (mask, 0);
71 LIBC_CANCEL_RESET (oldtype);
75 return __sigpause (mask, 0);