|
1 /*- |
|
2 * Copyright (c) 1991, 1993 |
|
3 * The Regents of the University of California. 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 * 1. Redistributions of source code must retain the above copyright |
|
9 * notice, this list of conditions and the following disclaimer. |
|
10 * 2. Redistributions in binary form must reproduce the above copyright |
|
11 * notice, this list of conditions and the following disclaimer in the |
|
12 * documentation and/or other materials provided with the distribution. |
|
13 * 4. Neither the name of the University nor the names of its contributors |
|
14 * may be used to endorse or promote products derived from this software |
|
15 * without specific prior written permission. |
|
16 * |
|
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
|
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
|
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
|
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
|
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
|
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
|
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
|
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
27 * SUCH DAMAGE. |
|
28 * |
|
29 * Portions Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. |
|
30 * @(#)signal.h 8.3 (Berkeley) 3/30/94 |
|
31 * $FreeBSD: src/include/signal.h,v 1.24 2003/03/31 23:30:41 jeff Exp $ |
|
32 */ |
|
33 |
|
34 #ifndef _SIGNAL_H_ |
|
35 #define _SIGNAL_H_ |
|
36 |
|
37 #include <sys/cdefs.h> |
|
38 #include <sys/types.h> |
|
39 #include <sys/signal.h> |
|
40 |
|
41 __BEGIN_DECLS |
|
42 |
|
43 struct timespec; |
|
44 /* The following definitions have been taken from siglist.c file |
|
45 * Once signals are implemented then these definitions must be moved to that |
|
46 * file. (sys_signame,sys_siglist,sys_nsig) */ |
|
47 |
|
48 static const char *const sys_signame[NSIG] = { |
|
49 "Signal 0", |
|
50 "hup", /* SIGHUP */ |
|
51 "int", /* SIGINT */ |
|
52 "quit", /* SIGQUIT */ |
|
53 "ill", /* SIGILL */ |
|
54 "trap", /* SIGTRAP */ |
|
55 "abrt", /* SIGABRT */ |
|
56 "emt", /* SIGEMT */ |
|
57 "fpe", /* SIGFPE */ |
|
58 "kill", /* SIGKILL */ |
|
59 "bus", /* SIGBUS */ |
|
60 "segv", /* SIGSEGV */ |
|
61 "sys", /* SIGSYS */ |
|
62 "pipe", /* SIGPIPE */ |
|
63 "alrm", /* SIGALRM */ |
|
64 "term", /* SIGTERM */ |
|
65 "urg", /* SIGURG */ |
|
66 "stop", /* SIGSTOP */ |
|
67 "tstp", /* SIGTSTP */ |
|
68 "cont", /* SIGCONT */ |
|
69 "chld", /* SIGCHLD */ |
|
70 "ttin", /* SIGTTIN */ |
|
71 "ttou", /* SIGTTOU */ |
|
72 "io", /* SIGIO */ |
|
73 "xcpu", /* SIGXCPU */ |
|
74 "xfsz", /* SIGXFSZ */ |
|
75 "vtalrm", /* SIGVTALRM */ |
|
76 "prof", /* SIGPROF */ |
|
77 "winch", /* SIGWINCH */ |
|
78 "info", /* SIGINFO */ |
|
79 "usr1", /* SIGUSR1 */ |
|
80 "usr2" /* SIGUSR2 */ |
|
81 }; |
|
82 |
|
83 static const char *const sys_siglist[NSIG] = { |
|
84 "Signal 0", |
|
85 "Hangup", /* SIGHUP */ |
|
86 "Interrupt", /* SIGINT */ |
|
87 "Quit", /* SIGQUIT */ |
|
88 "Illegal instruction", /* SIGILL */ |
|
89 "Trace/BPT trap", /* SIGTRAP */ |
|
90 "Abort trap", /* SIGABRT */ |
|
91 "EMT trap", /* SIGEMT */ |
|
92 "Floating point exception", /* SIGFPE */ |
|
93 "Killed", /* SIGKILL */ |
|
94 "Bus error", /* SIGBUS */ |
|
95 "Segmentation fault", /* SIGSEGV */ |
|
96 "Bad system call", /* SIGSYS */ |
|
97 "Broken pipe", /* SIGPIPE */ |
|
98 "Alarm clock", /* SIGALRM */ |
|
99 "Terminated", /* SIGTERM */ |
|
100 "Urgent I/O condition", /* SIGURG */ |
|
101 "Suspended (signal)", /* SIGSTOP */ |
|
102 "Suspended", /* SIGTSTP */ |
|
103 "Continued", /* SIGCONT */ |
|
104 "Child exited", /* SIGCHLD */ |
|
105 "Stopped (tty input)", /* SIGTTIN */ |
|
106 "Stopped (tty output)", /* SIGTTOU */ |
|
107 "I/O possible", /* SIGIO */ |
|
108 "Cputime limit exceeded", /* SIGXCPU */ |
|
109 "Filesize limit exceeded", /* SIGXFSZ */ |
|
110 "Virtual timer expired", /* SIGVTALRM */ |
|
111 "Profiling timer expired", /* SIGPROF */ |
|
112 "Window size changes", /* SIGWINCH */ |
|
113 "Information request", /* SIGINFO */ |
|
114 "User defined signal 1", /* SIGUSR1 */ |
|
115 "User defined signal 2" /* SIGUSR2 */ |
|
116 }; |
|
117 |
|
118 #if !defined (SIG_BLOCK) |
|
119 #define SIG_UNBLOCK 1 |
|
120 #define SIG_BLOCK 2 |
|
121 #define SIG_SETMASK 3 |
|
122 #endif |
|
123 |
|
124 /* Type for data associated with a signal. */ |
|
125 union sigval |
|
126 { |
|
127 int sival_int; |
|
128 void *sival_ptr; |
|
129 }; |
|
130 |
|
131 typedef struct __siginfo_t |
|
132 { |
|
133 int si_signo; |
|
134 int si_code; |
|
135 int si_errno; |
|
136 pid_t si_pid; |
|
137 uid_t si_uid; |
|
138 void *si_addr; |
|
139 int si_status; |
|
140 long si_band; |
|
141 union sigval si_value; |
|
142 } siginfo_t; |
|
143 |
|
144 |
|
145 typedef struct sigevent |
|
146 { |
|
147 union sigval sigev_value; |
|
148 int sigev_signo; |
|
149 int sigev_notify; |
|
150 |
|
151 void (*sigev_notify_function) (union sigval); /* Function to start. */ |
|
152 void *sigev_notify_attributes; /* Really pthread_attr_t. */ |
|
153 } sigevent_t; |
|
154 |
|
155 /* `sigev_notify' values. */ |
|
156 enum |
|
157 { |
|
158 SIGEV_SIGNAL = 0, /* Notify via signal. */ |
|
159 # define SIGEV_SIGNAL SIGEV_SIGNAL |
|
160 SIGEV_NONE, /* Other notification: meaningless. */ |
|
161 # define SIGEV_NONE SIGEV_NONE |
|
162 SIGEV_THREAD, /* Deliver via thread creation. */ |
|
163 # define SIGEV_THREAD SIGEV_THREAD |
|
164 |
|
165 SIGEV_THREAD_ID = 4 /* Send signal to specific thread. */ |
|
166 #define SIGEV_THREAD_ID SIGEV_THREAD_ID |
|
167 }; |
|
168 |
|
169 static const int sys_nsig = sizeof(sys_siglist) / sizeof(sys_siglist[0]); |
|
170 |
|
171 IMPORT_C int sigaction(int sig, const struct sigaction *act, struct sigaction *oact); |
|
172 |
|
173 IMPORT_C int sigemptyset(sigset_t* set); |
|
174 |
|
175 #ifdef SYMBIAN_OE_POSIX_SIGNALS |
|
176 IMPORT_C int kill(pid_t pid, int sig); |
|
177 IMPORT_C int raise(int sig); |
|
178 IMPORT_C int sigqueue(pid_t pid, int sig, const union sigval value); |
|
179 |
|
180 IMPORT_C int sigfillset(sigset_t *set); |
|
181 IMPORT_C int sigaddset(sigset_t *set, int signo); |
|
182 IMPORT_C int sigdelset(sigset_t *set, int signo); |
|
183 IMPORT_C int sigismember(const sigset_t *set, int signo); |
|
184 IMPORT_C int sigandset(sigset_t * set, const sigset_t * left, const sigset_t * right); |
|
185 IMPORT_C int sigorset(sigset_t * set, const sigset_t * left, const sigset_t * right); |
|
186 IMPORT_C int sigisemptyset(const sigset_t * set); |
|
187 |
|
188 IMPORT_C int sigprocmask(int how, const sigset_t* set,sigset_t* oset); |
|
189 IMPORT_C int sighold(int signo); |
|
190 IMPORT_C int sigrelse(int signo); |
|
191 IMPORT_C int sigpause(int signo); |
|
192 |
|
193 IMPORT_C int sigwait(const sigset_t *set, int *sig); |
|
194 IMPORT_C int sigtimedwait(const sigset_t *set, siginfo_t *info, |
|
195 const struct timespec *timeout); |
|
196 IMPORT_C int sigwaitinfo(const sigset_t *set, siginfo_t *info); |
|
197 |
|
198 IMPORT_C void (*bsd_signal(int, void (*)(int)))(int); |
|
199 IMPORT_C void (*sigset(int, void (*)(int)))(int); |
|
200 IMPORT_C void (*signal(int, void (*)(int)))(int); |
|
201 IMPORT_C int sigpending(sigset_t *set); |
|
202 IMPORT_C int sigignore(int sig); |
|
203 IMPORT_C void psignal(int sig, const char *s); |
|
204 |
|
205 IMPORT_C int sigenable(); |
|
206 |
|
207 #endif |
|
208 __END_DECLS |
|
209 |
|
210 #endif /* !_SIGNAL_H_ */ |