|
|
1.1 root 1: /*
2: * Copyright (c) 1982, 1986, 1989, 1991 Regents of the University of California.
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: * 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: * 3. All advertising materials mentioning features or use of this software
14: * must display the following acknowledgement:
15: * This product includes software developed by the University of
16: * California, Berkeley and its contributors.
17: * 4. Neither the name of the University nor the names of its contributors
18: * may be used to endorse or promote products derived from this software
19: * without specific prior written permission.
20: *
21: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31: * SUCH DAMAGE.
32: *
1.1.1.3 ! root 33: * from: @(#)signal.h 7.16 (Berkeley) 3/17/91
! 34: * signal.h,v 1.5 1993/06/16 22:15:06 jtc Exp
1.1 root 35: */
36:
1.1.1.3 ! root 37: #ifndef _SYS_SIGNAL_H_
! 38: #define _SYS_SIGNAL_H_
1.1 root 39:
40: #define NSIG 32 /* counting 0; could be 33 (mask is 1-32) */
41:
42: #ifndef _POSIX_SOURCE
43: #include <machine/trap.h> /* codes for SIGILL, SIGFPE */
44: #endif /* _POSIX_SOURCE */
45:
46: #define SIGHUP 1 /* hangup */
47: #define SIGINT 2 /* interrupt */
48: #define SIGQUIT 3 /* quit */
49: #define SIGILL 4 /* illegal instruction (not reset when caught) */
50: #ifndef _POSIX_SOURCE
51: #define SIGTRAP 5 /* trace trap (not reset when caught) */
52: #endif
53: #define SIGABRT 6 /* abort() */
54: #ifndef _POSIX_SOURCE
55: #define SIGIOT SIGABRT /* compatibility */
56: #define SIGEMT 7 /* EMT instruction */
57: #endif
58: #define SIGFPE 8 /* floating point exception */
59: #define SIGKILL 9 /* kill (cannot be caught or ignored) */
60: #ifndef _POSIX_SOURCE
61: #define SIGBUS 10 /* bus error */
62: #endif
63: #define SIGSEGV 11 /* segmentation violation */
64: #ifndef _POSIX_SOURCE
65: #define SIGSYS 12 /* bad argument to system call */
66: #endif
67: #define SIGPIPE 13 /* write on a pipe with no one to read it */
68: #define SIGALRM 14 /* alarm clock */
69: #define SIGTERM 15 /* software termination signal from kill */
70: #ifndef _POSIX_SOURCE
71: #define SIGURG 16 /* urgent condition on IO channel */
72: #endif
73: #define SIGSTOP 17 /* sendable stop signal not from tty */
74: #define SIGTSTP 18 /* stop signal from tty */
75: #define SIGCONT 19 /* continue a stopped process */
76: #define SIGCHLD 20 /* to parent on child stop or exit */
77: #define SIGTTIN 21 /* to readers pgrp upon background tty read */
78: #define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */
79: #ifndef _POSIX_SOURCE
80: #define SIGIO 23 /* input/output possible signal */
81: #define SIGXCPU 24 /* exceeded CPU time limit */
82: #define SIGXFSZ 25 /* exceeded file size limit */
83: #define SIGVTALRM 26 /* virtual time alarm */
84: #define SIGPROF 27 /* profiling time alarm */
85: #define SIGWINCH 28 /* window size changes */
86: #define SIGINFO 29 /* information request */
87: #endif
88: #define SIGUSR1 30 /* user defined signal 1 */
89: #define SIGUSR2 31 /* user defined signal 2 */
90:
91: #include <sys/cdefs.h>
92:
93: #ifndef _POSIX_SOURCE
94: typedef void (*sig_t) __P((int));
95: #endif
96:
1.1.1.2 root 97: typedef void (*__sighandler_t) __P((int));
1.1 root 98: typedef unsigned int sigset_t;
1.1.1.3 ! root 99: typedef int sig_atomic_t;
1.1 root 100:
101: __BEGIN_DECLS
102: int sigaddset __P((sigset_t *, int));
103: int sigdelset __P((sigset_t *, int));
104: int sigemptyset __P((sigset_t *));
105: int sigfillset __P((sigset_t *));
106: int sigismember __P((const sigset_t *, int));
107: __END_DECLS
108:
109: #define sigemptyset(set) ( *(set) = 0 )
110: #define sigfillset(set) ( *(set) = ~(sigset_t)0, 0 )
111: #define sigaddset(set, signo) ( *(set) |= 1 << ((signo) - 1), 0)
112: #define sigdelset(set, signo) ( *(set) &= ~(1 << ((signo) - 1)), 0)
113: #define sigismember(set, signo) ( (*(set) & (1 << ((signo) - 1))) != 0)
114:
115: /*
116: * Signal vector "template" used in sigaction call.
117: */
118: struct sigaction {
1.1.1.2 root 119: __sighandler_t sa_handler; /* signal handler */
1.1 root 120: sigset_t sa_mask; /* signal mask to apply */
121: int sa_flags; /* see signal options below */
122: };
123: #ifndef _POSIX_SOURCE
124: #define SA_ONSTACK 0x0001 /* take signal on signal stack */
125: #define SA_RESTART 0x0002 /* do not restart system on signal return */
126: #endif
127: #define SA_NOCLDSTOP 0x0004 /* do not generate SIGCHLD on child stop */
128:
129: /*
130: * Flags for sigprocmask:
131: */
132: #define SIG_BLOCK 1 /* block specified signal set */
133: #define SIG_UNBLOCK 2 /* unblock specified signal set */
134: #define SIG_SETMASK 3 /* set specified signal set */
135:
136: #ifndef _POSIX_SOURCE
137: /*
138: * 4.3 compatibility:
139: * Signal vector "template" used in sigvec call.
140: */
141: struct sigvec {
142: void (*sv_handler)(); /* signal handler */
143: int sv_mask; /* signal mask to apply */
144: int sv_flags; /* see signal options below */
145: };
146: #define SV_ONSTACK SA_ONSTACK
147: #define SV_INTERRUPT SA_RESTART /* same bit, opposite sense */
148: #define sv_onstack sv_flags /* isn't compatibility wonderful! */
149:
150: /*
151: * Structure used in sigaltstack call.
152: */
153: struct sigaltstack {
154: char *ss_base; /* signal stack base */
155: int ss_len; /* signal stack length */
156: int ss_onstack; /* current status */
157: };
158:
159: /*
160: * Structure used in sigstack call.
161: */
162: struct sigstack {
163: char *ss_sp; /* signal stack pointer */
164: int ss_onstack; /* current status */
165: };
166:
167: /*
168: * Information pushed on stack when a signal is delivered.
169: * This is used by the kernel to restore state following
170: * execution of the signal handler. It is also made available
171: * to the handler to allow it to restore state properly if
172: * a non-standard exit is performed.
173: */
174: struct sigcontext {
175: int sc_onstack; /* sigstack state to restore */
176: int sc_mask; /* signal mask to restore */
177: int sc_sp; /* sp to restore */
178: int sc_fp; /* fp to restore */
179: int sc_ap; /* ap to restore */
180: int sc_pc; /* pc to restore */
181: int sc_ps; /* psl to restore */
182: };
183:
184: /*
185: * Macro for converting signal number to a mask suitable for
186: * sigblock().
187: */
188: #define sigmask(m) (1 << ((m)-1))
189:
1.1.1.3 ! root 190: #define SIG_ERR ((__sighandler_t) -1)
1.1 root 191: #endif /* _POSIX_SOURCE */
1.1.1.2 root 192:
193: #define SIG_DFL ((__sighandler_t) 0)
194: #define SIG_IGN ((__sighandler_t) 1)
1.1 root 195:
196: #ifndef KERNEL
197: #include <sys/types.h>
198:
199: __BEGIN_DECLS
1.1.1.2 root 200: /*void (*signal __P((int, void (*) __P((int))))) __P((int));*/
201: __sighandler_t signal __P((int, __sighandler_t));
1.1 root 202: int raise __P((int));
203: #ifndef _ANSI_SOURCE
204: int kill __P((pid_t, int));
205: int sigaction __P((int, const struct sigaction *, struct sigaction *));
206: int sigpending __P((sigset_t *));
207: int sigprocmask __P((int, const sigset_t *, sigset_t *));
208: int sigsuspend __P((const sigset_t *));
209: #endif /* !_ANSI_SOURCE */
210: #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
211: int killpg __P((pid_t, int));
212: void psignal __P((unsigned, const char *));
213: int sigblock __P((int));
214: int siginterrupt __P((int, int));
215: int sigpause __P((int));
216: int sigreturn __P((struct sigcontext *));
217: int sigsetmask __P((int));
218: int sigstack __P((const struct sigstack *, struct sigstack *));
219: int sigvec __P((int, struct sigvec *, struct sigvec *));
220: #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
221: __END_DECLS
222:
223: #endif /* !KERNEL */
1.1.1.3 ! root 224:
! 225: #endif /* !_SYS_SIGNAL_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.