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 kcm Quit (usually CTRL\-\e)
133 SIGILL 4 Kc Illegal instruction
134 SIGTRAP 5 Kc Trace trap
135 SIGABRT 6 kcm Abort program
136 SIGBUS 7 Kc Bus error
137 SIGFPE 8 Kc Floating point exception
139 SIGUSR1 10 k User defined signal #1
140 SIGSEGV 11 Kc Segmentation fault
141 SIGUSR2 12 k User defined signal #2
142 SIGPIPE 13 k Write to a pipe with no reader
143 SIGALRM 14 k Alarm clock
144 SIGTERM 15 km Terminate (default for kill(1))
145 SIGEMT 16 xKc Emulator trap
146 SIGCHLD 17 pi Child process terminated
147 SIGCONT 18 pi Continue if stopped
148 SIGSTOP 19 ps Stop signal
149 SIGTSTP 20 ps Interactive stop signal
150 SIGWINCH 21 xi Window size change
151 SIGTTIN 22 ps Background read
152 SIGTTOU 23 ps Background write
153 SIGVTALRM 24 k Virtual alarm clock
154 SIGPROF 25 k Profiler alarm clock
158 The letters in the notes column indicate:
162 The process is killed if the signal is not caught.
165 The process is killed if the signal is not caught. If the signal is received
166 due to an exception while ignored or masked, the process is killed even if a
167 handler is defined to catch the signal.
170 The signal causes a core dump.
173 The signal is ignored if not caught.
176 The signal is converted to a message for system processes.
179 MINIX 3 extension, not defined by \s-2POSIX\s+2.
182 These signals are not implemented, but \s-2POSIX\s+2 requires that they are
186 The process should be stopped, but is killed instead.
192 signals cannot be caught or ignored. The
196 signals cannot be automatically reset. The system silently enforces these
197 restrictions. This may or may not be reflected by the attributes of these
198 signals and the signal masks.
200 \s-2POSIX\s+2 prescribes that <sys/types.h> has the following definition:
203 .B "typedef int (*sighandler_t)(int)"
206 With this type the following declarations can be made:
211 sighandler_t sa_handler;
212 sighandler_t signal(int \fIsig\fP, sighandler_t \fIhandler\fP);
217 This may help you to understand the earlier declarations better. The
219 type is also very useful in old style C code that is compiled by a compiler
237 returns the old handler on success or
239 on error. The error code may be:
252 Kees J. Bot (kjb@cs.vu.nl)
255 .\" $PchId: sigaction.2,v 1.2 1996/04/11 06:00:28 philip Exp $