1 /*
2 Copyright (C) 2001, 2004, 2005 Axis Communications AB.
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions
7 are met:
8 
9 1. Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
11 
12 2. Neither the name of Axis Communications nor the names of its
13 contributors may be used to endorse or promote products derived
14 from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY AXIS COMMUNICATIONS AND ITS CONTRIBUTORS
17 AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AXIS
20 COMMUNICATIONS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
21 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
26 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 POSSIBILITY OF SUCH DAMAGE.
28  */
29 /* This file is to be kept in sync (well, reasonably so, it's quite
30    different) with newlib/libc/include/sys/signal.h on which it is
31    based, except values used or returned by syscalls must be those of
32    the Linux/CRIS kernel.  */
33 
34 /* sys/signal.h */
35 
36 #ifndef _SYS_SIGNAL_H
37 #define _SYS_SIGNAL_H
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 #include <sys/features.h>
43 #include <sys/types.h>
44 
45 typedef unsigned long sigset_t;
46 
47 /* Adjusted to linux, has unused sa_restorer field and unsigned long
48    sa_flags; relatively unimportant though.  */
49 /* Type of a signal handler.  */
50 typedef void (*__sighandler_t)(int);
51 
52 /* The type used in newlib sources.  */
53 typedef __sighandler_t _sig_func_ptr;
54 
55 struct sigaction {
56 	__sighandler_t sa_handler;
57 	sigset_t sa_mask;
58 	unsigned long sa_flags;
59 	void (*sa_restorer)(void);
60 };
61 
62 /* Adjusted to glibc; other values.  */
63 #define SA_NOCLDSTOP 1	/* only value supported now for sa_flags */
64 
65 #if __POSIX_VISIBLE
66 #define SIG_SETMASK 2	/* set mask with sigprocmask() */
67 #define SIG_BLOCK 0	/* set of signals to block */
68 #define SIG_UNBLOCK 1	/* set of signals to, well, unblock */
69 
70 int sigprocmask (int __how, const sigset_t *__a, sigset_t *__b);
71 #endif	/* __POSIX_VISIBLE */
72 
73 #ifdef _LIBC
74 int _kill (pid_t, int);
75 #endif
76 
77 #if __POSIX_VISIBLE
78 
79 int kill (pid_t, int);
80 int sigaddset (sigset_t *, const int);
81 int sigdelset (sigset_t *, const int);
82 int sigismember (const sigset_t *, int);
83 int sigfillset (sigset_t *);
84 int sigemptyset (sigset_t *);
85 
86 /* These depend upon the type of sigset_t, which right now
87    is always a long.. They're in the POSIX namespace, but
88    are not ANSI. */
89 #define sigaddset(what,sig) (*(what) |= (1<<(sig)), 0)
90 #define sigdelset(what,sig) (*(what) &= ~(1<<(sig)), 0)
91 #define sigemptyset(what)   (*(what) = 0, 0)
92 #define sigfillset(what)    (*(what) = ~(0), 0)
93 #define sigismember(what,sig) (((*(what)) & (1<<(sig))) != 0)
94 
95 #endif	/* __POSIX_VISIBLE */
96 
97 /* Using __MISC_VISIBLE until POSIX Issue 8 is officially released */
98 #if __MISC_VISIBLE
99 
100 /* POSIX Issue 8 adds sig2str() and str2sig() */
101 
102 #define SIG2STR_MAX 17	/* (sizeof("RTMAX+") + sizeof("4294967295") - 1) */
103 
104 int sig2str(int, char *);
105 int str2sig(const char *__restrict, int *__restrict);
106 
107 #endif /* __MISC_VISIBLE */
108 
109 #define SIGHUP		 1
110 #define SIGINT		 2
111 #define SIGQUIT		 3
112 #define SIGILL		 4
113 #define SIGTRAP		 5
114 #define SIGABRT		 6
115 #define SIGIOT		 6
116 #define SIGBUS		 7
117 #define SIGFPE		 8
118 #define SIGKILL		 9
119 #define SIGUSR1		10
120 #define SIGSEGV		11
121 #define SIGUSR2		12
122 #define SIGPIPE		13
123 #define SIGALRM		14
124 #define SIGTERM		15
125 #define SIGSTKFLT	16
126 #define SIGCHLD		17
127 #define SIGCONT		18
128 #define SIGSTOP		19
129 #define SIGTSTP		20
130 #define SIGTTIN		21
131 #define SIGTTOU		22
132 #define SIGURG		23
133 #define SIGXCPU		24
134 #define SIGXFSZ		25
135 #define SIGVTALRM	26
136 #define SIGPROF		27
137 #define SIGWINCH	28
138 #define SIGIO		29
139 #define SIGPOLL		SIGIO
140 #define SIGPWR		30
141 #define	NSIG 31
142 
143 #ifdef __cplusplus
144 }
145 #endif
146 #ifndef _SIGNAL_H_
147 /* Some applications take advantage of the fact that <sys/signal.h>
148  * and <signal.h> are equivalent in glibc.  Allow for that here.  */
149 #include <signal.h>
150 #endif
151 #endif /* _SYS_SIGNAL_H */
152