chiark / gitweb /
[PATCH] added klibc version 0.82 (cvs tree) to the udev tree.
[elogind.git] / klibc / klibc / include / signal.h
1 /*
2  * signal.h
3  */
4
5 #ifndef _SIGNAL_H
6 #define _SIGNAL_H
7
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>
13
14 /* Some architectures don't define these */
15 #ifndef SA_RESETHAND
16 # define SA_RESETHAND SA_ONESHOT
17 #endif
18 #ifndef SA_NODEFER
19 # define SA_NODEFER SA_NOMASK
20 #endif
21 #ifndef NSIG
22 # define NSIG _NSIG
23 #endif
24
25 __extern const char * const sys_siglist[];
26
27 /* This assumes sigset_t is either an unsigned long or an array of such,
28    and that _NSIG_BPW in the kernel is always LONG_BIT */
29
30 static __inline__ int sigemptyset(sigset_t *__set)
31 {
32   memset(__set, 0, sizeof *__set);
33   return 0;
34 }
35 static __inline__ int sigfillset(sigset_t *__set)
36 {
37   memset(__set, ~0, sizeof *__set);
38   return 0;
39 }
40 static __inline__ int sigaddset(sigset_t *__set, int __signum)
41 {
42   unsigned long *__lset = (unsigned long *)__set;
43   __lset[__signum/LONG_BIT] |= 1UL << (__signum%LONG_BIT);
44   return 0;
45 }
46 static __inline__ int sigdelset(sigset_t *__set, int __signum)
47 {
48   unsigned long *__lset = (unsigned long *)__set;
49   __lset[__signum/LONG_BIT] &= ~(1UL << (__signum%LONG_BIT));
50   return 0;
51 }
52 static __inline__ int sigismember(sigset_t *__set, int __signum)
53 {
54   unsigned long *__lset = (unsigned long *)__set;
55   return (int)((__lset[__signum/LONG_BIT] >> (__signum%LONG_BIT)) & 1);
56 }
57
58 __extern __sighandler_t __signal(int, __sighandler_t, int);
59 __extern __sighandler_t signal(int, __sighandler_t);
60 __extern __sighandler_t bsd_signal(int, __sighandler_t);
61 __extern int sigaction(int, const struct sigaction *, struct sigaction *);
62 __extern int sigprocmask(int, const sigset_t *, sigset_t *);
63 __extern int sigpending(sigset_t *);
64 __extern int sigsuspend(const sigset_t *);
65 __extern int rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t);
66 __extern int rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t);
67 __extern int rt_sigpending(sigset_t *, size_t);
68 __extern int rt_sigsuspend(const sigset_t *, size_t);
69 __extern int raise(int);
70 __extern int kill(pid_t, int);
71
72 #endif /* _SIGNAL_H */