clean up pthread_sigmask/sigprocmask dependency order
authorRich Felker <dalias@aerifal.cx>
Sun, 31 Jul 2011 01:09:14 +0000 (21:09 -0400)
committerRich Felker <dalias@aerifal.cx>
Sun, 31 Jul 2011 01:09:14 +0000 (21:09 -0400)
it's nicer for the function that doesn't use errno to be independent,
and have the other one call it. saves some time and avoids clobbering
errno.

src/signal/sigprocmask.c
src/thread/pthread_sigmask.c

index 3f003af..67e2b82 100644 (file)
@@ -1,14 +1,10 @@
 #include <signal.h>
 #include <errno.h>
-#include "syscall.h"
-#include "libc.h"
-#include "pthread_impl.h"
 
 int sigprocmask(int how, const sigset_t *set, sigset_t *old)
 {
-       if (how > 2U) {
-               errno = EINVAL;
-               return -1;
-       }
-       return syscall(SYS_rt_sigprocmask, how, set, old, 8);
+       int r = pthread_sigmask(how, set, old);
+       if (!r) return r;
+       errno = r;
+       return -1;
 }
index 6cc21d2..60a440b 100644 (file)
@@ -1,10 +1,10 @@
 #include <signal.h>
 #include <errno.h>
 #include <pthread.h>
+#include "syscall.h"
 
 int pthread_sigmask(int how, const sigset_t *set, sigset_t *old)
 {
-       int ret = sigprocmask(how, set, old);
-       if (ret) return errno;
-       return 0;
+       if (how > 2U) return EINVAL;
+       return -__syscall(SYS_rt_sigprocmask, how, set, old, 8);
 }