FreeBSD/Linux Kernel Cross Reference
sys/include/signal.h
1 /* The <signal.h> header defines all the ANSI and POSIX signals.
2 * MINIX supports all the signals required by POSIX. They are defined below.
3 * Some additional signals are also supported.
4 */
5
6 #ifndef _SIGNAL_H
7 #define _SIGNAL_H
8
9 #ifndef _ANSI_H
10 #include <ansi.h>
11 #endif
12 #ifdef _POSIX_SOURCE
13 #ifndef _TYPES_H
14 #include <sys/types.h>
15 #endif
16 #endif
17
18 /* Here are types that are closely associated with signal handling. */
19 typedef int sig_atomic_t;
20
21 #ifdef _POSIX_SOURCE
22 #ifndef _SIGSET_T
23 #define _SIGSET_T
24 typedef unsigned long sigset_t;
25 #endif
26 #endif
27
28 #define SIGHUP 1 /* hangup */
29 #define SIGINT 2 /* interrupt (DEL) */
30 #define SIGQUIT 3 /* quit (ASCII FS) */
31 #define SIGILL 4 /* illegal instruction */
32 #define SIGTRAP 5 /* trace trap (not reset when caught) */
33 #define SIGABRT 6 /* IOT instruction */
34 #define SIGIOT 6 /* SIGABRT for people who speak PDP-11 */
35 #define SIGUNUSED 7 /* spare code */
36 #define SIGFPE 8 /* floating point exception */
37 #define SIGKILL 9 /* kill (cannot be caught or ignored) */
38 #define SIGUSR1 10 /* user defined signal # 1 */
39 #define SIGSEGV 11 /* segmentation violation */
40 #define SIGUSR2 12 /* user defined signal # 2 */
41 #define SIGPIPE 13 /* write on a pipe with no one to read it */
42 #define SIGALRM 14 /* alarm clock */
43 #define SIGTERM 15 /* software termination signal from kill */
44 #define SIGCHLD 17 /* child process terminated or stopped */
45
46 #define SIGEMT 7 /* obsolete */
47 #define SIGBUS 10 /* obsolete */
48
49 /* MINIX specific signals. These signals are not used by user proceses,
50 * but meant to inform system processes, like the PM, about system events.
51 */
52 #define SIGKMESS 18 /* new kernel message */
53 #define SIGKSIG 19 /* kernel signal pending */
54 #define SIGKSTOP 20 /* kernel shutting down */
55
56 /* Regular signals. */
57 #define SIGWINCH 21 /* window size has changed */
58
59 #define _NSIG 21 /* number of signals used */
60
61 /* POSIX requires the following signals to be defined, even if they are
62 * not supported. Here are the definitions, but they are not supported.
63 */
64 #define SIGCONT 18 /* continue if stopped */
65 #define SIGSTOP 19 /* stop signal */
66 #define SIGTSTP 20 /* interactive stop signal */
67 #define SIGTTIN 21 /* background process wants to read */
68 #define SIGTTOU 22 /* background process wants to write */
69
70 /* The sighandler_t type is not allowed unless _POSIX_SOURCE is defined. */
71 typedef void _PROTOTYPE( (*__sighandler_t), (int) );
72
73 /* Macros used as function pointers. */
74 #define SIG_ERR ((__sighandler_t) -1) /* error return */
75 #define SIG_DFL ((__sighandler_t) 0) /* default signal handling */
76 #define SIG_IGN ((__sighandler_t) 1) /* ignore signal */
77 #define SIG_HOLD ((__sighandler_t) 2) /* block signal */
78 #define SIG_CATCH ((__sighandler_t) 3) /* catch signal */
79 #define SIG_MESS ((__sighandler_t) 4) /* pass as message (MINIX) */
80
81 #ifdef _POSIX_SOURCE
82 struct sigaction {
83 __sighandler_t sa_handler; /* SIG_DFL, SIG_IGN, or pointer to function */
84 sigset_t sa_mask; /* signals to be blocked during handler */
85 int sa_flags; /* special flags */
86 };
87
88 /* Fields for sa_flags. */
89 #define SA_ONSTACK 0x0001 /* deliver signal on alternate stack */
90 #define SA_RESETHAND 0x0002 /* reset signal handler when signal caught */
91 #define SA_NODEFER 0x0004 /* don't block signal while catching it */
92 #define SA_RESTART 0x0008 /* automatic system call restart */
93 #define SA_SIGINFO 0x0010 /* extended signal handling */
94 #define SA_NOCLDWAIT 0x0020 /* don't create zombies */
95 #define SA_NOCLDSTOP 0x0040 /* don't receive SIGCHLD when child stops */
96
97 /* POSIX requires these values for use with sigprocmask(2). */
98 #define SIG_BLOCK 0 /* for blocking signals */
99 #define SIG_UNBLOCK 1 /* for unblocking signals */
100 #define SIG_SETMASK 2 /* for setting the signal mask */
101 #define SIG_INQUIRE 4 /* for internal use only */
102 #endif /* _POSIX_SOURCE */
103
104 /* POSIX and ANSI function prototypes. */
105 _PROTOTYPE( int raise, (int _sig) );
106 _PROTOTYPE( __sighandler_t signal, (int _sig, __sighandler_t _func) );
107
108 #ifdef _POSIX_SOURCE
109 _PROTOTYPE( int kill, (pid_t _pid, int _sig) );
110 _PROTOTYPE( int sigaction,
111 (int _sig, const struct sigaction *_act, struct sigaction *_oact) );
112 _PROTOTYPE( int sigaddset, (sigset_t *_set, int _sig) );
113 _PROTOTYPE( int sigdelset, (sigset_t *_set, int _sig) );
114 _PROTOTYPE( int sigemptyset, (sigset_t *_set) );
115 _PROTOTYPE( int sigfillset, (sigset_t *_set) );
116 _PROTOTYPE( int sigismember, (const sigset_t *_set, int _sig) );
117 _PROTOTYPE( int sigpending, (sigset_t *_set) );
118 _PROTOTYPE( int sigprocmask,
119 (int _how, const sigset_t *_set, sigset_t *_oset) );
120 _PROTOTYPE( int sigsuspend, (const sigset_t *_sigmask) );
121 #endif
122
123 #endif /* _SIGNAL_H */
Cache object: d7e6fcd745d669a609cb8de7facbb5de
|