1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- #include <errno.h>
- #include <signal.h>
- #define __need_NULL
- #include <stddef.h>
- #include <sysdep-cancel.h>
- #include <sys/syscall.h>
- #include <bits/libc-lock.h>
- extern int __syscall_rt_sigtimedwait (const sigset_t *, siginfo_t *,
- const struct timespec *, size_t);
- static __inline__ int
- do_sigwait (const sigset_t *set, int *sig)
- {
- int ret;
-
- #ifdef INTERNAL_SYSCALL
- INTERNAL_SYSCALL_DECL (err);
- ret = INTERNAL_SYSCALL (rt_sigtimedwait, err, 4, set,
- NULL, NULL, _NSIG / 8);
- if (! INTERNAL_SYSCALL_ERROR_P (ret, err))
- {
- *sig = ret;
- ret = 0;
- }
- else
- ret = INTERNAL_SYSCALL_ERRNO (ret, err);
- #else
- ret = INLINE_SYSCALL (rt_sigtimedwait, 4, set,
- NULL, NULL, _NSIG / 8);
- if (ret != -1)
- {
- *sig = ret;
- ret = 0;
- }
- else
- ret = errno;
- #endif
- return ret;
- }
- #ifndef SHARED
- weak_extern (__pthread_sigwait)
- #endif
- int
- sigwait (const sigset_t *set, int *sig)
- {
- #ifndef NOT_IN_libc
- return __libc_maybe_call2 (pthread_sigwait, (set, sig),
- do_sigwait (set, sig));
- #else
- return do_sigwait (set, sig);
- #endif
- }
- strong_alias(sigwait, __libc_sigwait)
- LIBC_CANCEL_HANDLED ();
|