8 #include <klibc/extern.h>
9 #include <string.h> /* For memset() */
10 #include <limits.h> /* For LONG_BIT */
11 #include <sys/types.h>
12 #include <asm/signal.h>
14 #include <klibc/archsignal.h>
16 /* glibc seems to use sig_atomic_t as "int" pretty much on all architectures.
17 Do the same, but allow the architecture to override. */
18 #ifdef _KLIBC_HAS_ARCH_SIG_ATOMIC_T
19 typedef int sig_atomic_t;
22 /* Some architectures don't define these */
24 # define SA_RESETHAND SA_ONESHOT
27 # define SA_NODEFER SA_NOMASK
33 __extern const char * const sys_siglist[];
35 /* This assumes sigset_t is either an unsigned long or an array of such,
36 and that _NSIG_BPW in the kernel is always LONG_BIT */
38 static __inline__ int sigemptyset(sigset_t *__set)
40 memset(__set, 0, sizeof *__set);
43 static __inline__ int sigfillset(sigset_t *__set)
45 memset(__set, ~0, sizeof *__set);
48 static __inline__ int sigaddset(sigset_t *__set, int __signum)
50 unsigned long *__lset = (unsigned long *)__set;
51 __lset[__signum/LONG_BIT] |= 1UL << (__signum%LONG_BIT);
54 static __inline__ int sigdelset(sigset_t *__set, int __signum)
56 unsigned long *__lset = (unsigned long *)__set;
57 __lset[__signum/LONG_BIT] &= ~(1UL << (__signum%LONG_BIT));
60 static __inline__ int sigismember(sigset_t *__set, int __signum)
62 unsigned long *__lset = (unsigned long *)__set;
63 return (int)((__lset[__signum/LONG_BIT] >> (__signum%LONG_BIT)) & 1);
66 __extern __sighandler_t __signal(int, __sighandler_t, int);
67 __extern __sighandler_t sysv_signal(int, __sighandler_t);
68 __extern __sighandler_t bsd_signal(int, __sighandler_t);
69 __extern int sigaction(int, const struct sigaction *, struct sigaction *);
70 __extern int sigprocmask(int, const sigset_t *, sigset_t *);
71 __extern int sigpending(sigset_t *);
72 __extern int sigsuspend(const sigset_t *);
73 __extern int rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t);
74 __extern int rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t);
75 __extern int rt_sigpending(sigset_t *, size_t);
76 __extern int rt_sigsuspend(const sigset_t *, size_t);
77 __extern int raise(int);
78 __extern int kill(pid_t, int);
80 #endif /* _SIGNAL_H */