summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2011-04-24 00:21:30 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2012-06-15 14:00:42 +0200
commitefe9077ecf6114680aac09ae1cd0910b300c8d12 (patch)
treef01dfe8900bb5a98768e1a247cdb5792639b8c06
parent19607f1113ef9916a0a0ac2bf99b5bc32526f0de (diff)
sigpause.c: provide the X/Open variant, since the BSD version is deprecated
Do not export __sigpause. Provide __bsd_sigpause (unprototyped) if anyone may need it. Adapt cancellation to use cancel.h. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-rw-r--r--include/signal.h11
-rw-r--r--libc/signal/sigpause.c38
2 files changed, 19 insertions, 30 deletions
diff --git a/include/signal.h b/include/signal.h
index 052467758..41018565d 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -195,17 +195,20 @@ extern void psiginfo (__const siginfo_t *__pinfo, __const char *__s);
This function is a cancellation point and therefore not marked with
__THROW. */
-extern int __sigpause (int __sig_or_mask, int __is_sig);
+/*extern int __sigpause (int __sig_or_mask, int __is_sig);*/
#ifdef __FAVOR_BSD
/* Set the mask of blocked signals to MASK,
wait for a signal to arrive, and then restore the mask. */
-extern int sigpause (int __mask) __THROW __attribute_deprecated__;
-# define sigpause(mask) __sigpause ((mask), 0)
+/*extern int sigpause (int __mask) __THROW __attribute_deprecated__;
+# define sigpause(mask) __sigpause ((mask), 0)*/
+/* uClibc note: BSD sigpause is available as __bsd_sigpause.
+ * It is intentionally not prototyped */
#else
# ifdef __USE_XOPEN
/* Remove a signal from the signal mask and suspend the process. */
-# define sigpause(sig) __sigpause ((sig), 1)
+extern int sigpause(int __sig);
+/*# define sigpause(sig) __sigpause ((sig), 1)*/
# endif
#endif
#endif /* __UCLIBC_SUSV4_LEGACY__ */
diff --git a/libc/signal/sigpause.c b/libc/signal/sigpause.c
index ebd7af3b9..63afeead2 100644
--- a/libc/signal/sigpause.c
+++ b/libc/signal/sigpause.c
@@ -17,22 +17,16 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#define __UCLIBC_HIDE_DEPRECATED__
-/* psm: need the BSD version of sigpause here */
-#include <errno.h>
-#define __FAVOR_BSD
#include <signal.h>
#define __need_NULL
#include <stddef.h>
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
-#include <sysdep-cancel.h>
-#endif
+#include <cancel.h>
#include "sigset-cvt-mask.h"
/* Set the mask of blocked signals to MASK,
wait for a signal to arrive, and then restore the mask. */
-static int __internal_sigpause (int sig_or_mask, int is_sig)
+static int __sigpause (int sig_or_mask, int is_sig)
{
sigset_t set;
@@ -50,29 +44,21 @@ static int __internal_sigpause (int sig_or_mask, int is_sig)
/* Note the sigpause() is a cancellation point. But since we call
sigsuspend() which itself is a cancellation point we do not have
to do anything here. */
- return sigsuspend (&set);
+ /* uClibc note: not true on uClibc, we call the non-cancellable version */
+ return __NC(sigsuspend)(&set);
}
-strong_alias(__internal_sigpause,__sigpause)
-#undef sigpause
+int __bsd_sigpause(int mask);
+int __bsd_sigpause(int mask)
+{
+ return __sigpause(mask, 0);
+}
/* We have to provide a default version of this function since the
standards demand it. The version which is a bit more reasonable is
the BSD version. So make this the default. */
-int sigpause (int mask)
+static int __NC(sigpause)(int sig)
{
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
- if (SINGLE_THREAD_P)
- return __internal_sigpause (mask, 0);
-
- int oldtype = LIBC_CANCEL_ASYNC ();
-
- int result = __internal_sigpause (mask, 0);
-
- LIBC_CANCEL_RESET (oldtype);
-
- return result;
-#else
- return __internal_sigpause (mask, 0);
-#endif
+ return __sigpause(sig, 1);
}
+CANCELLABLE_SYSCALL(int, sigpause, (int sig), (sig))