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.
14 #include <sys/types.h>
18 /* Here are types that are closely associated with signal handling. */
19 typedef int sig_atomic_t;
24 typedef unsigned long sigset_t
;
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 #define SIGVTALRM 24 /* virtual alarm */
48 #define SIGPROF 25 /* profiler alarm */
50 /* POSIX requires the following signals to be defined, even if they are
51 * not supported. Here are the definitions, but they are not supported.
53 #define SIGCONT 18 /* continue if stopped */
54 #define SIGSTOP 19 /* stop signal */
55 #define SIGTSTP 20 /* interactive stop signal */
56 #define SIGTTIN 22 /* background process wants to read */
57 #define SIGTTOU 23 /* background process wants to write */
59 #define _NSIG 26 /* highest signal number plus one */
62 #define SIGIOT SIGABRT /* for people who speak PDP-11 */
64 /* MINIX specific signals. These signals are not used by user proceses,
65 * but meant to inform system processes, like the PM, about system events.
67 #define SIGKMESS 29 /* new kernel message */
68 #define SIGKSIG 30 /* kernel signal pending */
69 #define SIGNDELAY 31 /* end of delay for signal delivery */
73 /* The sighandler_t type is not allowed unless _POSIX_SOURCE is defined. */
74 typedef void _PROTOTYPE( (*__sighandler_t
), (int) );
76 /* Macros used as function pointers. */
77 #define SIG_ERR ((__sighandler_t) -1) /* error return */
78 #define SIG_DFL ((__sighandler_t) 0) /* default signal handling */
79 #define SIG_IGN ((__sighandler_t) 1) /* ignore signal */
80 #define SIG_HOLD ((__sighandler_t) 2) /* block signal */
81 #define SIG_CATCH ((__sighandler_t) 3) /* catch signal */
82 #define SIG_MESS ((__sighandler_t) 4) /* pass as message (MINIX) */
86 __sighandler_t sa_handler
; /* SIG_DFL, SIG_IGN, or pointer to function */
87 sigset_t sa_mask
; /* signals to be blocked during handler */
88 int sa_flags
; /* special flags */
91 /* Fields for sa_flags. */
92 #define SA_ONSTACK 0x0001 /* deliver signal on alternate stack */
93 #define SA_RESETHAND 0x0002 /* reset signal handler when signal caught */
94 #define SA_NODEFER 0x0004 /* don't block signal while catching it */
95 #define SA_RESTART 0x0008 /* automatic system call restart */
96 #define SA_SIGINFO 0x0010 /* extended signal handling */
97 #define SA_NOCLDWAIT 0x0020 /* don't create zombies */
98 #define SA_NOCLDSTOP 0x0040 /* don't receive SIGCHLD when child stops */
100 /* POSIX requires these values for use with sigprocmask(2). */
101 #define SIG_BLOCK 0 /* for blocking signals */
102 #define SIG_UNBLOCK 1 /* for unblocking signals */
103 #define SIG_SETMASK 2 /* for setting the signal mask */
104 #define SIG_INQUIRE 4 /* for internal use only */
105 #endif /* _POSIX_SOURCE */
107 /* POSIX and ANSI function prototypes. */
108 _PROTOTYPE( int raise
, (int _sig
) );
109 _PROTOTYPE( __sighandler_t signal
, (int _sig
, __sighandler_t _func
) );
112 _PROTOTYPE( int kill
, (pid_t _pid
, int _sig
) );
113 _PROTOTYPE( int killpg
, (pid_t _pgrp
, int _sig
) );
114 _PROTOTYPE( int sigaction
,
115 (int _sig
, const struct sigaction
*_act
, struct sigaction
*_oact
) );
116 _PROTOTYPE( int sigpending
, (sigset_t
*_set
) );
117 _PROTOTYPE( int sigprocmask
,
118 (int _how
, const sigset_t
*_set
, sigset_t
*_oset
) );
119 _PROTOTYPE( int sigsuspend
, (const sigset_t
*_sigmask
) );
121 /* For the sigset functions, only use the library version with error
122 * checking from user programs. System programs need to be able to use
123 * nonstanard signals.
126 _PROTOTYPE( int sigaddset
, (sigset_t
*_set
, int _sig
) );
127 _PROTOTYPE( int sigdelset
, (sigset_t
*_set
, int _sig
) );
128 _PROTOTYPE( int sigemptyset
, (sigset_t
*_set
) );
129 _PROTOTYPE( int sigfillset
, (sigset_t
*_set
) );
130 _PROTOTYPE( int sigismember
, (const sigset_t
*_set
, int _sig
) );
132 #define sigaddset(set, sig) ((int) ((*(set) |= (1 << (sig))) && 0))
133 #define sigdelset(set, sig) ((int) ((*(set) &= ~(1 << (sig))) && 0))
134 #define sigemptyset(set) ((int) (*(set) = 0))
135 #define sigfillset(set) ((int) ((*(set) = ~0) && 0))
136 #define sigismember(set, sig) ((*(set) & (1 << (sig))) ? 1 : 0)
141 #endif /* _SIGNAL_H */