3 sigaction, signal \- manage signal state and handlers
10 int sigaction(int \fIsig\fP, const struct sigaction *\fIact\fP, struct sigaction *\fIoact\fP)
13 void (*signal(int \fIsig\fP, void (*\fIhandler\fP)(int)))(int);
21 is used to examine, set, or modify the attributes of a signal. The argument
23 is the signal in question. The
25 argument points to a structure containing the new attributes of the signal,
26 the structure pointed to by
28 will receive the old attributes that were in effect before the call.
36 to indicate that either no new attributes are to be set, or that the old
37 attributes are not of interest.
39 The structure containing the signal attributes is defined in <signal.h> and
47 void (*sa_handler)(int sig);
57 field contains the address of a signal handler, a function that is called
58 when the process is signalled, or one of these special constants:
62 Default signal handling is to be performed. This usually means that the
63 process is killed, but some signals may be ignored by default.
70 field indicates a set of signals that must be blocked when the signal is
71 being handled. Whether the signal
73 itself is blocked when being handled is not controlled by this mask. The
74 mask is of a "signal set" type that is to be manipulated by the
78 How the signal is handled precisely is specified by bits in
80 If none of the flags is set then the handler is called when the signal
81 arrives. The signal is blocked during the call to the handler, and
82 unblocked when the handler returns. A system call that is interrupted
89 The following bit flags can be set to modify this behaviour:
93 Reset the signal handler to
95 when the signal is caught.
98 Do not block the signal on entry to the handler.
101 Handle the signal in a way that is compatible with the the old
107 signal system call sets a signal handler for a given signal and returns the
108 old signal handler. No signals are blocked, the flags are
109 .BR "SA_RESETHAND | SA_NODEFER | SA_COMPAT" .
110 New code should not use
116 flags are MINIX 3 extensions.
118 Signal handlers are reset to
122 Signals that are ignored stay ignored.
124 MINIX 3 knows about the following signals:
128 signal num notes description
131 SIGINT 2 k Interrupt (usually DEL or CTRL\-C)
132 SIGQUIT 3 kc Quit (usually CTRL\-\e)
133 SIGILL 4 kc Illegal instruction
134 SIGTRAP 5 xkc Trace trap
135 SIGABRT 6 kc Abort program
136 SIGFPE 8 k Floating point exception
138 SIGUSR1 10 k User defined signal #1
139 SIGSEGV 11 kc Segmentation fault
140 SIGUSR2 12 k User defined signal #2
141 SIGPIPE 13 k Write to a pipe with no reader
142 SIGALRM 14 k Alarm clock
143 SIGTERM 15 k Terminate (default for kill(1))
144 SIGCHLD 17 pvi Child process terminated
145 SIGCONT 18 p Continue if stopped
146 SIGSTOP 19 ps Stop signal
147 SIGTSTP 20 ps Interactive stop signal
148 SIGTTIN 21 ps Background read
149 SIGTTOU 22 ps Background write
150 SIGWINCH 23 xvi Window size change
154 The letters in the notes column indicate:
158 The process is killed if the signal is not caught.
161 The signal causes a core dump.
164 The signal is ignored if not caught.
167 Only Minix-vmd implements this signal.
170 MINIX 3 extension, not defined by \s-2POSIX\s+2.
173 These signals are not implemented, but \s-2POSIX\s+2 requires that they are
177 The process should be stopped, but is killed instead.
181 signal cannot be caught or ignored. The
185 signals cannot be automatically reset. The system silently enforces these
186 restrictions. This may or may not be reflected by the attributes of these
187 signals and the signal masks.
189 \s-2POSIX\s+2 prescribes that <sys/types.h> has the following definition:
192 .B "typedef int (*sighandler_t)(int)"
195 With this type the following declarations can be made:
200 sighandler_t sa_handler;
201 sighandler_t signal(int \fIsig\fP, sighandler_t \fIhandler\fP);
206 This may help you to understand the earlier declarations better. The
208 type is also very useful in old style C code that is compiled by a compiler
226 returns the old handler on success or
228 on error. The error code may be:
241 Kees J. Bot (kjb@cs.vu.nl)
244 .\" $PchId: sigaction.2,v 1.2 1996/04/11 06:00:28 philip Exp $