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 | /* Regular signals. */
|
---|
29 | #define SIGHUP 1 /* hangup */
|
---|
30 | #define SIGINT 2 /* interrupt (DEL) */
|
---|
31 | #define SIGQUIT 3 /* quit (ASCII FS) */
|
---|
32 | #define SIGILL 4 /* illegal instruction */
|
---|
33 | #define SIGTRAP 5 /* trace trap (not reset when caught) */
|
---|
34 | #define SIGABRT 6 /* IOT instruction */
|
---|
35 | #define SIGBUS 7 /* bus error */
|
---|
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 SIGEMT 16 /* EMT instruction */
|
---|
45 | #define SIGCHLD 17 /* child process terminated or stopped */
|
---|
46 | #define SIGWINCH 21 /* window size has changed */
|
---|
47 |
|
---|
48 | /* POSIX requires the following signals to be defined, even if they are
|
---|
49 | * not supported. Here are the definitions, but they are not supported.
|
---|
50 | */
|
---|
51 | #define SIGCONT 18 /* continue if stopped */
|
---|
52 | #define SIGSTOP 19 /* stop signal */
|
---|
53 | #define SIGTSTP 20 /* interactive stop signal */
|
---|
54 | #define SIGTTIN 22 /* background process wants to read */
|
---|
55 | #define SIGTTOU 23 /* background process wants to write */
|
---|
56 |
|
---|
57 | #define _NSIG 23 /* number of signals used */
|
---|
58 |
|
---|
59 | #ifdef _MINIX
|
---|
60 | #define SIGIOT SIGABRT /* for people who speak PDP-11 */
|
---|
61 |
|
---|
62 | /* MINIX specific signals. These signals are not used by user proceses,
|
---|
63 | * but meant to inform system processes, like the PM, about system events.
|
---|
64 | */
|
---|
65 | #define SIGKMESS 29 /* new kernel message */
|
---|
66 | #define SIGKSIG 30 /* kernel signal pending */
|
---|
67 | #define SIGKSTOP 31 /* kernel shutting down */
|
---|
68 |
|
---|
69 | #endif
|
---|
70 |
|
---|
71 | /* The sighandler_t type is not allowed unless _POSIX_SOURCE is defined. */
|
---|
72 | typedef void _PROTOTYPE( (*__sighandler_t), (int) );
|
---|
73 |
|
---|
74 | /* Macros used as function pointers. */
|
---|
75 | #define SIG_ERR ((__sighandler_t) -1) /* error return */
|
---|
76 | #define SIG_DFL ((__sighandler_t) 0) /* default signal handling */
|
---|
77 | #define SIG_IGN ((__sighandler_t) 1) /* ignore signal */
|
---|
78 | #define SIG_HOLD ((__sighandler_t) 2) /* block signal */
|
---|
79 | #define SIG_CATCH ((__sighandler_t) 3) /* catch signal */
|
---|
80 | #define SIG_MESS ((__sighandler_t) 4) /* pass as message (MINIX) */
|
---|
81 |
|
---|
82 | #ifdef _POSIX_SOURCE
|
---|
83 | struct sigaction {
|
---|
84 | __sighandler_t sa_handler; /* SIG_DFL, SIG_IGN, or pointer to function */
|
---|
85 | sigset_t sa_mask; /* signals to be blocked during handler */
|
---|
86 | int sa_flags; /* special flags */
|
---|
87 | };
|
---|
88 |
|
---|
89 | /* Fields for sa_flags. */
|
---|
90 | #define SA_ONSTACK 0x0001 /* deliver signal on alternate stack */
|
---|
91 | #define SA_RESETHAND 0x0002 /* reset signal handler when signal caught */
|
---|
92 | #define SA_NODEFER 0x0004 /* don't block signal while catching it */
|
---|
93 | #define SA_RESTART 0x0008 /* automatic system call restart */
|
---|
94 | #define SA_SIGINFO 0x0010 /* extended signal handling */
|
---|
95 | #define SA_NOCLDWAIT 0x0020 /* don't create zombies */
|
---|
96 | #define SA_NOCLDSTOP 0x0040 /* don't receive SIGCHLD when child stops */
|
---|
97 |
|
---|
98 | /* POSIX requires these values for use with sigprocmask(2). */
|
---|
99 | #define SIG_BLOCK 0 /* for blocking signals */
|
---|
100 | #define SIG_UNBLOCK 1 /* for unblocking signals */
|
---|
101 | #define SIG_SETMASK 2 /* for setting the signal mask */
|
---|
102 | #define SIG_INQUIRE 4 /* for internal use only */
|
---|
103 | #endif /* _POSIX_SOURCE */
|
---|
104 |
|
---|
105 | /* POSIX and ANSI function prototypes. */
|
---|
106 | _PROTOTYPE( int raise, (int _sig) );
|
---|
107 | _PROTOTYPE( __sighandler_t signal, (int _sig, __sighandler_t _func) );
|
---|
108 |
|
---|
109 | #ifdef _POSIX_SOURCE
|
---|
110 | _PROTOTYPE( int kill, (pid_t _pid, int _sig) );
|
---|
111 | _PROTOTYPE( int sigaction,
|
---|
112 | (int _sig, const struct sigaction *_act, struct sigaction *_oact) );
|
---|
113 | _PROTOTYPE( int sigaddset, (sigset_t *_set, int _sig) );
|
---|
114 | _PROTOTYPE( int sigdelset, (sigset_t *_set, int _sig) );
|
---|
115 | _PROTOTYPE( int sigemptyset, (sigset_t *_set) );
|
---|
116 | _PROTOTYPE( int sigfillset, (sigset_t *_set) );
|
---|
117 | _PROTOTYPE( int sigismember, (const sigset_t *_set, int _sig) );
|
---|
118 | _PROTOTYPE( int sigpending, (sigset_t *_set) );
|
---|
119 | _PROTOTYPE( int sigprocmask,
|
---|
120 | (int _how, const sigset_t *_set, sigset_t *_oset) );
|
---|
121 | _PROTOTYPE( int sigsuspend, (const sigset_t *_sigmask) );
|
---|
122 | #endif
|
---|
123 |
|
---|
124 | #endif /* _SIGNAL_H */
|
---|