Magellan Linux

Annotation of /trunk/mkinitrd-magellan/klibc/usr/include/signal.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 815 - (hide annotations) (download)
Fri Apr 24 18:32:46 2009 UTC (15 years ago) by niro
File MIME type: text/plain
File size: 2898 byte(s)
-updated to klibc-1.5.15
1 niro 532 /*
2     * signal.h
3     */
4    
5     #ifndef _SIGNAL_H
6     #define _SIGNAL_H
7    
8     #include <klibc/compiler.h>
9     #include <klibc/extern.h>
10     #include <string.h> /* For memset() */
11     #include <limits.h> /* For LONG_BIT */
12     #include <sys/types.h>
13    
14     #include <klibc/archsignal.h> /* Includes <asm/signal.h> if appropriate */
15    
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     #ifndef _KLIBC_HAS_ARCH_SIG_ATOMIC_T
19     typedef int sig_atomic_t;
20     #endif
21    
22     /* Some architectures don't define these */
23     #ifndef SA_RESETHAND
24     # define SA_RESETHAND SA_ONESHOT
25     #endif
26     #ifndef SA_NODEFER
27     # define SA_NODEFER SA_NOMASK
28     #endif
29     /* Some architectures define NSIG and not _NSIG or vice versa */
30     #ifndef NSIG
31     # define NSIG _NSIG
32     #endif
33     #ifndef _NSIG
34     # define _NSIG NSIG
35     #endif
36    
37     /* If we don't have any real-time signals available to userspace,
38     hide them all */
39     #if SIGRTMAX <= SIGRTMIN
40     # undef SIGRTMIN
41     # undef SIGRTMAX
42     #endif
43    
44     /* The kernel header files are inconsistent whether or not
45     SIGRTMAX is inclusive or exclusive. POSIX seems to state that
46     it's inclusive, however. */
47     #if SIGRTMAX >= _NSIG
48     # undef SIGRTMAX
49     # define SIGRTMAX (_NSIG-1)
50     #endif
51    
52     __extern const char *const sys_siglist[_NSIG];
53     __extern const char *const sys_sigabbrev[_NSIG];
54    
55     /* This assumes sigset_t is either an unsigned long or an array of such,
56     and that _NSIG_BPW in the kernel is always LONG_BIT */
57    
58     static __inline__ int sigemptyset(sigset_t * __set)
59     {
60     memset(__set, 0, sizeof *__set);
61     return 0;
62     }
63     static __inline__ int sigfillset(sigset_t * __set)
64     {
65     memset(__set, ~0, sizeof *__set);
66     return 0;
67     }
68     static __inline__ int sigaddset(sigset_t * __set, int __signum)
69     {
70     unsigned long *__lset = (unsigned long *)__set;
71     __signum--; /* Signal 0 is not in the set */
72     __lset[__signum / LONG_BIT] |= 1UL << (__signum % LONG_BIT);
73     return 0;
74     }
75     static __inline__ int sigdelset(sigset_t * __set, int __signum)
76     {
77     unsigned long *__lset = (unsigned long *)__set;
78     __signum--; /* Signal 0 is not in the set */
79     __lset[__signum / LONG_BIT] &= ~(1UL << (__signum % LONG_BIT));
80     return 0;
81     }
82     static __inline__ int sigismember(sigset_t * __set, int __signum)
83     {
84     unsigned long *__lset = (unsigned long *)__set;
85     __signum--; /* Signal 0 is not in the set */
86     return (int)((__lset[__signum / LONG_BIT] >> (__signum % LONG_BIT)) &
87     1);
88     }
89    
90     __extern __sighandler_t __signal(int, __sighandler_t, int);
91 niro 815 #ifndef signal
92     __extern __sighandler_t signal(int, __sighandler_t);
93     #endif
94 niro 532 __extern __sighandler_t sysv_signal(int, __sighandler_t);
95     __extern __sighandler_t bsd_signal(int, __sighandler_t);
96     __extern int sigaction(int, const struct sigaction *, struct sigaction *);
97     __extern int sigprocmask(int, const sigset_t *, sigset_t *);
98     __extern int sigpending(sigset_t *);
99     __extern int sigsuspend(const sigset_t *);
100     __extern int raise(int);
101     __extern int kill(pid_t, int);
102    
103     #endif /* _SIGNAL_H */