1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
#ifndef _UCB_SYS_SIGNAL_H
#define _UCB_SYS_SIGNAL_H
/*
* 4.3BSD signal compatibility header
*
* this file includes all standard SVR4 header info, plus the 4.3BSD
* structures - 4.3BSD signal codes are translated to SVR4 generic
* signal codes where applicable
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* SysV <signal.h>
*/
/* ---- <signal.h> ---- */
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
#ifndef _SIGNAL_H
#define _SIGNAL_H
/* ---- <sys/signal.h> ---- */
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#ifndef _SYS_SIGNAL_H
#define _SYS_SIGNAL_H
#define SIGHUP 1 /* hangup */
#define SIGINT 2 /* interrupt (rubout) */
#define SIGQUIT 3 /* quit (ASCII FS) */
#define SIGILL 4 /* illegal instruction (not reset when caught) */
#define SIGTRAP 5 /* trace trap (not reset when caught) */
#define SIGIOT 6 /* IOT instruction */
#define SIGABRT 6 /* used by abort, replace SIGIOT in the future */
#define SIGEMT 7 /* EMT instruction */
#define SIGFPE 8 /* floating point exception */
#define SIGKILL 9 /* kill (cannot be caught or ignored) */
#define SIGBUS 10 /* bus error */
#define SIGSEGV 11 /* segmentation violation */
#define SIGSYS 12 /* bad argument to system call */
#define SIGPIPE 13 /* write on a pipe with no one to read it */
#define SIGALRM 14 /* alarm clock */
#define SIGTERM 15 /* software termination signal from kill */
#define SIGUSR1 16 /* user defined signal 1 */
#define SIGUSR2 17 /* user defined signal 2 */
#define SIGCLD 18 /* child status change */
#define SIGCHLD 18 /* child status change alias (POSIX) */
#define SIGPWR 19 /* power-fail restart */
#define SIGWINCH 20 /* window size change */
#define SIGURG 21 /* urgent socket condition */
#define SIGPOLL 22 /* pollable event occured */
#define SIGIO SIGPOLL /* socket I/O possible (SIGPOLL alias) */
#define SIGSTOP 23 /* stop (cannot be caught or ignored) */
#define SIGTSTP 24 /* user stop requested from tty */
#define SIGCONT 25 /* stopped process has been continued */
#define SIGTTIN 26 /* background tty read attempted */
#define SIGTTOU 27 /* background tty write attempted */
#define SIGVTALRM 28 /* virtual timer expired */
#define SIGPROF 29 /* profiling timer expired */
#define SIGXCPU 30 /* exceeded cpu limit */
#define SIGXFSZ 31 /* exceeded file size limit */
#define SIGWAITING 32 /* process's lwps are blocked */
#define SIGLWP 33 /* special signal used by thread library */
#if defined(__cplusplus)
typedef void SIG_FUNC_TYP(int);
typedef SIG_FUNC_TYP *SIG_TYP;
#define SIG_PF SIG_TYP
#define SIG_DFL (SIG_PF)0
#define SIG_ERR (SIG_PF)-1
#define SIG_IGN (SIG_PF)1
#define SIG_HOLD (SIG_PF)2
#elif defined(lint)
#define SIG_DFL (void(*)(int))0
#define SIG_ERR (void(*)(int))0
#define SIG_IGN (void (*)(int))0
#define SIG_HOLD (void(*)(int))0
#else
#define SIG_DFL (void(*)())0
#define SIG_ERR (void(*)())-1
#define SIG_IGN (void (*)())1
#define SIG_HOLD (void(*)())2
#endif
#define SIG_BLOCK 1
#define SIG_UNBLOCK 2
#define SIG_SETMASK 3
#define SIGNO_MASK 0xFF
#define SIGDEFER 0x100
#define SIGHOLD 0x200
#define SIGRELSE 0x400
#define SIGIGNORE 0x800
#define SIGPAUSE 0x1000
#if !defined(_STRICT_STDC) || defined(_POSIX_SOURCE)
#ifndef _SIGSET_T
#define _SIGSET_T
typedef struct { /* signal set type */
unsigned int __sigbits[4];
} sigset_t;
#endif /* _SIGSET_T */
struct sigaction {
int sa_flags;
#if defined(__cplusplus)
void (*sa_handler)(int);
#else
void (*sa_handler)();
#endif
sigset_t sa_mask;
int sa_resv[2];
};
/* this is only valid for SIGCLD */
#define SA_NOCLDSTOP 0x00020000 /* don't send job control SIGCLD's */
#endif
#if !defined(_STRICT_STDC) && !defined(_POSIX_SOURCE)
/* non-comformant ANSI compilation */
/* definitions for the sa_flags field */
#define SA_ONSTACK 0x00000001
#define SA_RESETHAND 0x00000002
#define SA_RESTART 0x00000004
#define SA_SIGINFO 0x00000008
#define SA_NODEFER 0x00000010
/* this is only valid for SIGCLD */
#define SA_NOCLDWAIT 0x00010000 /* don't save zombie children */
#define NSIG 34 /* valid signals range from 1 to NSIG-1 */
#define MAXSIG 33 /* size of u_signal[], NSIG-1 <= MAXSIG */
#define MINSIGSTKSZ 2048
#define SIGSTKSZ 8192
#define SS_ONSTACK 0x00000001
#define SS_DISABLE 0x00000002
struct sigaltstack {
char *ss_sp;
int ss_size;
int ss_flags;
};
typedef struct sigaltstack stack_t;
#endif /* __STDC__ && !POSIX */
#endif /* _SYS_SIGNAL_H */
/* ---- end of SysV <sys/signal.h> ---- */
typedef int sig_atomic_t;
#if defined(__STDC__)
extern const char *_sys_siglist[];
extern const int _sys_nsig;
#ifdef __cplusplus
extern "C" SIG_PF signal(int, SIG_PF);
#else
extern void (*signal(int, void (*)(int)))(int);
#endif
extern int raise(int);
#if !defined(_STRICT_STDC) || defined(_POSIX_SOURCE) || \
defined(_XOPEN_SOURCE)
extern int kill(pid_t, int);
extern int sigaction(int, const struct sigaction *, struct sigaction *);
extern int sigaddset(sigset_t *, int);
extern int sigdelset(sigset_t *, int);
extern int sigemptyset(sigset_t *);
extern int sigfillset(sigset_t *);
extern int sigismember(const sigset_t *, int);
extern int sigpending(sigset_t *);
extern int sigprocmask(int, const sigset_t *, sigset_t *);
extern int sigsuspend(const sigset_t *);
#endif
#if !defined(_STRICT_STDC) && !defined(_POSIX_SOURCE)
extern int gsignal(int);
extern void (*sigset(int, void (*)(int)))(int);
extern int sighold(int);
extern int sigrelse(int);
extern int sigignore(int);
extern int sigpause(int);
extern int (*ssignal(int, int (*)(int)))(int);
extern int sigaltstack(const stack_t *, stack_t *);
/* extern int sigsend(idtype_t, id_t, int); */
/* extern int sigsendset(const procset_t *, int); */
#endif
#else
extern char *_sys_siglist[];
extern int _sys_nsig;
extern void(*signal())();
extern void(*sigset())();
#endif /* __STDC__ */
#endif /* _SIGNAL_H */
/* ---- end of SysV <signal.h> ---- */
#define sigmask(m) (m > 32 ? 0 : (1 << ((m)-1)))
/*
* 4.3BSD structure used in sigstack call.
*/
struct sigstack {
char *ss_sp; /* signal stack pointer */
int ss_onstack; /* current status */
};
#define SV_ONSTACK 0x0001 /* take signal on signal stack */
#define SV_INTERRUPT 0x0002 /* do not restart system on signal return */
#define SV_RESETHAND 0x0004 /* reset handler to SIG_DFL when signal taken */
#define sv_onstack sv_flags
struct sigcontext {
int sc_onstack; /* sigstack state to restore */
int sc_mask; /* signal mask to restore */
#ifdef u3b2
int sc_sp; /* sp to restore */
int sc_fp; /* fp to restore */
int sc_ap; /* ap to restore */
int sc_pc; /* pc to restore */
int sc_ps; /* psw to restore */
#endif
#ifdef vax
int sc_sp; /* sp to restore */
int sc_fp; /* fp to restore */
int sc_ap; /* ap to restore */
int sc_pc; /* pc to restore */
int sc_ps; /* psl to restore */
#endif /* vax */
#ifdef mc68000
int sc_sp; /* sp to restore */
int sc_pc; /* pc to retore */
int sc_ps; /* psl to restore */
#endif /* mc68000 */
#ifdef __sparc
#define MAXWINDOW 31 /* max usable windows in sparc */
long sc_sp; /* sp to restore */
long sc_pc; /* pc to retore */
long sc_npc; /* next pc to restore */
long sc_psr; /* psr to restore */
/* aliased to REG_CCR for sparcv9 */
long sc_g1; /* register that must be restored */
long sc_o0;
int sc_wbcnt; /* number of outstanding windows */
char *sc_spbuf[MAXWINDOW]; /* sp's for each wbuf */
long sc_wbuf[MAXWINDOW][16]; /* outstanding window save buffer */
#endif /* __sparc */
#if defined(__amd64)
long sc_sp; /* sp to restore */
long sc_pc; /* pc to retore */
long sc_ps; /* psl to restore */
long sc_rax; /* rax to restore */
long sc_rdx; /* rdx to restore */
#define sc_r0 sc_rax
#define sc_r1 sc_rdx
#elif defined(__i386)
int sc_sp; /* sp to restore */
int sc_pc; /* pc to retore */
int sc_ps; /* psl to restore */
int sc_eax; /* eax to restore */
int sc_edx; /* edx to restore */
#define sc_r0 sc_eax
#define sc_r1 sc_edx
#endif
};
/*
* 4.3BSD signal vector structure used in sigvec call.
*/
struct sigvec {
#if defined(__cplusplus)
void (*sv_handler)(int, int, struct sigcontext *, char *);
#else
void (*sv_handler)(); /* signal handler */
#endif
int sv_mask; /* signal mask to apply */
int sv_flags; /* see signal options below */
};
#if defined(__STDC__)
extern int sigvec(int, struct sigvec *, struct sigvec *);
extern int sigblock(int);
extern int sigsetmask(int);
#endif
/*
* Signal codes taken verbatim from SunOS4.1
*/
#ifdef vax
#define ILL_RESAD_FAULT 0x0 /* reserved addressing fault */
#define ILL_PRIVIN_FAULT 0x1 /* privileged instruction fault */
#define ILL_RESOP_FAULT 0x2 /* reserved operand fault */
#endif /* vax */
#ifdef mc68000
#define ILL_ILLINSTR_FAULT 0x10 /* illegal instruction fault */
#define ILL_PRIVVIO_FAULT 0x20 /* privilege violation fault */
#define ILL_COPROCERR_FAULT 0x34 /* [coprocessor protocol error fault] */
#define ILL_TRAP1_FAULT 0x84 /* trap #1 fault */
#define ILL_TRAP2_FAULT 0x88 /* trap #2 fault */
#define ILL_TRAP3_FAULT 0x8c /* trap #3 fault */
#define ILL_TRAP4_FAULT 0x90 /* trap #4 fault */
#define ILL_TRAP5_FAULT 0x94 /* trap #5 fault */
#define ILL_TRAP6_FAULT 0x98 /* trap #6 fault */
#define ILL_TRAP7_FAULT 0x9c /* trap #7 fault */
#define ILL_TRAP8_FAULT 0xa0 /* trap #8 fault */
#define ILL_TRAP9_FAULT 0xa4 /* trap #9 fault */
#define ILL_TRAP10_FAULT 0xa8 /* trap #10 fault */
#define ILL_TRAP11_FAULT 0xac /* trap #11 fault */
#define ILL_TRAP12_FAULT 0xb0 /* trap #12 fault */
#define ILL_TRAP13_FAULT 0xb4 /* trap #13 fault */
#define ILL_TRAP14_FAULT 0xb8 /* trap #14 fault */
#endif /* mc68000 */
#ifdef sparc
#define ILL_STACK 0x00 /* bad stack */
#define ILL_ILLINSTR_FAULT 0x02 /* illegal instruction fault */
#define ILL_PRIVINSTR_FAULT 0x03 /* privileged instruction fault */
/* codes from 0x80 to 0xff are software traps */
#define ILL_TRAP_FAULT(n) ((n)+0x80) /* trap n fault */
#endif /* sparc */
#if defined(__i386) || defined(__amd64)
#define ILL_ILLINSTR_FAULT 0x02 /* illegal instruction fault */
#endif
#ifdef mc68000
#define EMT_EMU1010 0x28 /* line 1010 emulator trap */
#define EMT_EMU1111 0x2c /* line 1111 emulator trap */
#endif /* mc68000 */
#ifdef sparc
#define EMT_TAG 0x0a /* tag overflow */
#endif /* sparc */
#ifdef vax
#define FPE_INTOVF_TRAP 0x1 /* integer overflow */
#define FPE_INTDIV_TRAP 0x2 /* integer divide by zero */
#define FPE_FLTOVF_TRAP 0x3 /* floating overflow */
#define FPE_FLTDIV_TRAP 0x4 /* floating/decimal divide by zero */
#define FPE_FLTUND_TRAP 0x5 /* floating underflow */
#define FPE_DECOVF_TRAP 0x6 /* decimal overflow */
#define FPE_SUBRNG_TRAP 0x7 /* subscript out of range */
#define FPE_FLTOVF_FAULT 0x8 /* floating overflow fault */
#define FPE_FLTDIV_FAULT 0x9 /* divide by zero floating fault */
#define FPE_FLTUND_FAULT 0xa /* floating underflow fault */
#endif /* vax */
#ifdef mc68000
#define FPE_INTDIV_TRAP 0x14 /* integer divide by zero */
#define FPE_CHKINST_TRAP 0x18 /* CHK [CHK2] instruction */
#define FPE_TRAPV_TRAP 0x1c /* TRAPV [cpTRAPcc TRAPcc] instr */
#define FPE_FLTBSUN_TRAP 0xc0 /* [branch or set on unordered cond] */
#define FPE_FLTINEX_TRAP 0xc4 /* [floating inexact result] */
#define FPE_FLTDIV_TRAP 0xc8 /* [floating divide by zero] */
#define FPE_FLTUND_TRAP 0xcc /* [floating underflow] */
#define FPE_FLTOPERR_TRAP 0xd0 /* [floating operand error] */
#define FPE_FLTOVF_TRAP 0xd4 /* [floating overflow] */
#define FPE_FLTNAN_TRAP 0xd8 /* [floating Not-A-Number] */
#ifdef sun
#define FPE_FPA_ENABLE 0x400 /* [FPA not enabled] */
#define FPE_FPA_ERROR 0x404 /* [FPA arithmetic exception] */
#endif /* sun */
#endif /* mc68000 */
#ifdef sparc
#define FPE_INTOVF_TRAP 0x1 /* integer overflow */
#define FPE_STARTSIG_TRAP 0x2 /* process using fp */
#define FPE_INTDIV_TRAP 0x14 /* integer divide by zero */
#define FPE_FLTINEX_TRAP 0xc4 /* [floating inexact result] */
#define FPE_FLTDIV_TRAP 0xc8 /* [floating divide by zero] */
#define FPE_FLTUND_TRAP 0xcc /* [floating underflow] */
#define FPE_FLTOPERR_TRAP 0xd0 /* [floating operand error] */
#define FPE_FLTOVF_TRAP 0xd4 /* [floating overflow] */
#endif /* sparc */
/*
* The codes for SIGBUS and SIGSEGV are described in <vm/faultcode.h>
* These are the same between SunOS4.1 and SunOS5.0
*/
#include <vm/faultcode.h>
#define BUS_HWERR FC_HWERR /* misc hardware error (e.g. timeout) */
#define BUS_ALIGN FC_ALIGN /* hardware alignment error */
#ifdef BUS_OBJERR /* namespace conflict with SysV */
#undef BUS_OBJERR
#endif
#define BUS_OBJERR FC_OBJERR /* object returned errno value */
/*
* The BUS_CODE(code) will be one of the above. In the BUS_OBJERR case,
* doing a BUS_ERRNO(code) gives an errno value reported by the underlying
* file object mapped at the fault address. Note that this appears to be
* duplicated with the segmentation fault case below -- unfortunate, since
* the specification has always claimed that such errors produce SIGBUS.
* The segmentation cases are left defined as a transition aid.
*/
#define BUS_CODE(C) FC_CODE(C)
#define BUS_ERRNO(C) FC_ERRNO(C)
#define SEGV_NOMAP FC_NOMAP /* no mapping at the fault address */
#define SEGV_PROT FC_PROT /* access exceeded protections */
#define SEGV_OBJERR FC_OBJERR /* object returned errno value */
/*
* The SEGV_CODE(code) will be SEGV_NOMAP, SEGV_PROT, or SEGV_OBJERR.
* In the SEGV_OBJERR case, doing a SEGV_ERRNO(code) gives an errno value
* reported by the underlying file object mapped at the fault address.
*/
#define SEGV_CODE(C) FC_CODE(C)
#define SEGV_ERRNO(C) FC_ERRNO(C)
#define SEGV_MAKE_ERR(e) FC_MAKE_ERR(e)
#define SIG_NOADDR ((char *)~0)
#if defined(lint)
#define BADSIG (void(*)())0
#else
#define BADSIG (void(*)())-1
#endif
#ifdef __cplusplus
}
#endif
#endif /* _UCB_SYS_SIGNAL_H */
|