about summary refs log tree commit diff
path: root/sysdeps/posix/sigpause.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-08-27 02:43:22 +0000
committerRoland McGrath <roland@gnu.org>2002-08-27 02:43:22 +0000
commitb5d482d00ef8bc29f0b4dd84812d52759ebdd630 (patch)
tree95299ffce18eb88410cc0d49cc898a9fd40cc302 /sysdeps/posix/sigpause.c
parent20acbc25428bb7c9a78de37236285a09108da313 (diff)
downloadglibc-b5d482d00ef8bc29f0b4dd84812d52759ebdd630.tar.gz
glibc-b5d482d00ef8bc29f0b4dd84812d52759ebdd630.tar.xz
glibc-b5d482d00ef8bc29f0b4dd84812d52759ebdd630.zip
* sysdeps/generic/sigset-cvt-mask.h (sigset_set_old_mask): Replace
	macro with inline function.
	(sigset_get_old_mask): Likewise.
	* sysdeps/posix/sigblock.c (__sigblock): Update callers.
	* sysdeps/posix/sigsetmask.c (__sigsetmask): Likewise.
	* sysdeps/posix/sigpause.c (__sigpause): Likewise.
	* sysdeps/posix/sigvec.c (__sigvec, sigvec_wrapper_handler): Likewise.
	* sysdeps/unix/sysv/aix/sigset-cvt-mask.h
	(sigset_set_old_mask, sigset_get_old_mask): Make these macros return
	values.
	* sysdeps/unix/sysv/linux/sigset-cvt-mask.h: Likewise.
	* sysdeps/unix/sysv/sysv4/sigset-cvt-mask.h: Likewise.

2002-07-06  Bruno Haible  <bruno@clisp.org>

	* sysdeps/generic/sigset-cvt-mask.h (sigset_set_old_mask,
	sigset_get_old_mask): Make it work with larger sigset_t.
	* sysdeps/posix/sigblock.c (__sigblock): Use those macros.
	* sysdeps/posix/sigsetmask.c (__sigsetmask): Likewise.
	* sysdeps/posix/sigpause.c (__sigpause): Likewise.

2002-08-26  Roland McGrath  <roland@redhat.com>
Diffstat (limited to 'sysdeps/posix/sigpause.c')
-rw-r--r--sysdeps/posix/sigpause.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/sysdeps/posix/sigpause.c b/sysdeps/posix/sigpause.c
index fc5f79e31e..71818740ed 100644
--- a/sysdeps/posix/sigpause.c
+++ b/sysdeps/posix/sigpause.c
@@ -20,13 +20,14 @@
 #include <signal.h>
 #include <stddef.h>		/* For NULL.  */
 
+#include <sigset-cvt-mask.h>
+
 /* Set the mask of blocked signals to MASK,
    wait for a signal to arrive, and then restore the mask.  */
 int
 __sigpause (int sig_or_mask, int is_sig)
 {
   sigset_t set;
-  int sig;
 
   if (is_sig != 0)
     {
@@ -36,20 +37,8 @@ __sigpause (int sig_or_mask, int is_sig)
 	  || __sigdelset (&set, sig_or_mask) < 0)
 	return -1;
     }
-  else
-    {
-      if (__sigemptyset (&set) < 0)
-	return -1;
-
-      if (sizeof (sig_or_mask) == sizeof (set))
-	*(int *) &set = sig_or_mask;
-      else if (sizeof (unsigned long int) == sizeof (set))
-	*(unsigned long int *) &set = (unsigned int) sig_or_mask;
-      else
-	for (sig = 1; sig < NSIG; ++sig)
-	  if ((sig_or_mask & sigmask (sig)) && __sigaddset (&set, sig) < 0)
-	    return -1;
-    }
+  else if (sigset_set_old_mask (&set, sig_or_mask) < 0)
+    return -1;
 
   return __sigsuspend (&set);
 }