1signal(7) Miscellaneous Information Manual signal(7)
2
3
4
6 signal - overview of signals
7
9 Linux supports both POSIX reliable signals (hereinafter "standard sig‐
10 nals") and POSIX real-time signals.
11
12 Signal dispositions
13 Each signal has a current disposition, which determines how the process
14 behaves when it is delivered the signal.
15
16 The entries in the "Action" column of the table below specify the de‐
17 fault disposition for each signal, as follows:
18
19 Term Default action is to terminate the process.
20
21 Ign Default action is to ignore the signal.
22
23 Core Default action is to terminate the process and dump core (see
24 core(5)).
25
26 Stop Default action is to stop the process.
27
28 Cont Default action is to continue the process if it is currently
29 stopped.
30
31 A process can change the disposition of a signal using sigaction(2) or
32 signal(2). (The latter is less portable when establishing a signal
33 handler; see signal(2) for details.) Using these system calls, a
34 process can elect one of the following behaviors to occur on delivery
35 of the signal: perform the default action; ignore the signal; or catch
36 the signal with a signal handler, a programmer-defined function that is
37 automatically invoked when the signal is delivered.
38
39 By default, a signal handler is invoked on the normal process stack.
40 It is possible to arrange that the signal handler uses an alternate
41 stack; see sigaltstack(2) for a discussion of how to do this and when
42 it might be useful.
43
44 The signal disposition is a per-process attribute: in a multithreaded
45 application, the disposition of a particular signal is the same for all
46 threads.
47
48 A child created via fork(2) inherits a copy of its parent's signal dis‐
49 positions. During an execve(2), the dispositions of handled signals
50 are reset to the default; the dispositions of ignored signals are left
51 unchanged.
52
53 Sending a signal
54 The following system calls and library functions allow the caller to
55 send a signal:
56
57 raise(3)
58 Sends a signal to the calling thread.
59
60 kill(2)
61 Sends a signal to a specified process, to all members of a spec‐
62 ified process group, or to all processes on the system.
63
64 pidfd_send_signal(2)
65 Sends a signal to a process identified by a PID file descriptor.
66
67 killpg(3)
68 Sends a signal to all of the members of a specified process
69 group.
70
71 pthread_kill(3)
72 Sends a signal to a specified POSIX thread in the same process
73 as the caller.
74
75 tgkill(2)
76 Sends a signal to a specified thread within a specific process.
77 (This is the system call used to implement pthread_kill(3).)
78
79 sigqueue(3)
80 Sends a real-time signal with accompanying data to a specified
81 process.
82
83 Waiting for a signal to be caught
84 The following system calls suspend execution of the calling thread un‐
85 til a signal is caught (or an unhandled signal terminates the process):
86
87 pause(2)
88 Suspends execution until any signal is caught.
89
90 sigsuspend(2)
91 Temporarily changes the signal mask (see below) and suspends ex‐
92 ecution until one of the unmasked signals is caught.
93
94 Synchronously accepting a signal
95 Rather than asynchronously catching a signal via a signal handler, it
96 is possible to synchronously accept the signal, that is, to block exe‐
97 cution until the signal is delivered, at which point the kernel returns
98 information about the signal to the caller. There are two general ways
99 to do this:
100
101 • sigwaitinfo(2), sigtimedwait(2), and sigwait(3) suspend execution
102 until one of the signals in a specified set is delivered. Each of
103 these calls returns information about the delivered signal.
104
105 • signalfd(2) returns a file descriptor that can be used to read in‐
106 formation about signals that are delivered to the caller. Each
107 read(2) from this file descriptor blocks until one of the signals in
108 the set specified in the signalfd(2) call is delivered to the
109 caller. The buffer returned by read(2) contains a structure de‐
110 scribing the signal.
111
112 Signal mask and pending signals
113 A signal may be blocked, which means that it will not be delivered un‐
114 til it is later unblocked. Between the time when it is generated and
115 when it is delivered a signal is said to be pending.
116
117 Each thread in a process has an independent signal mask, which indi‐
118 cates the set of signals that the thread is currently blocking. A
119 thread can manipulate its signal mask using pthread_sigmask(3). In a
120 traditional single-threaded application, sigprocmask(2) can be used to
121 manipulate the signal mask.
122
123 A child created via fork(2) inherits a copy of its parent's signal
124 mask; the signal mask is preserved across execve(2).
125
126 A signal may be process-directed or thread-directed. A process-di‐
127 rected signal is one that is targeted at (and thus pending for) the
128 process as a whole. A signal may be process-directed because it was
129 generated by the kernel for reasons other than a hardware exception, or
130 because it was sent using kill(2) or sigqueue(3). A thread-directed
131 signal is one that is targeted at a specific thread. A signal may be
132 thread-directed because it was generated as a consequence of executing
133 a specific machine-language instruction that triggered a hardware ex‐
134 ception (e.g., SIGSEGV for an invalid memory access, or SIGFPE for a
135 math error), or because it was targeted at a specific thread using in‐
136 terfaces such as tgkill(2) or pthread_kill(3).
137
138 A process-directed signal may be delivered to any one of the threads
139 that does not currently have the signal blocked. If more than one of
140 the threads has the signal unblocked, then the kernel chooses an arbi‐
141 trary thread to which to deliver the signal.
142
143 A thread can obtain the set of signals that it currently has pending
144 using sigpending(2). This set will consist of the union of the set of
145 pending process-directed signals and the set of signals pending for the
146 calling thread.
147
148 A child created via fork(2) initially has an empty pending signal set;
149 the pending signal set is preserved across an execve(2).
150
151 Execution of signal handlers
152 Whenever there is a transition from kernel-mode to user-mode execution
153 (e.g., on return from a system call or scheduling of a thread onto the
154 CPU), the kernel checks whether there is a pending unblocked signal for
155 which the process has established a signal handler. If there is such a
156 pending signal, the following steps occur:
157
158 (1) The kernel performs the necessary preparatory steps for execution
159 of the signal handler:
160
161 (1.1) The signal is removed from the set of pending signals.
162
163 (1.2) If the signal handler was installed by a call to sigac‐
164 tion(2) that specified the SA_ONSTACK flag and the thread
165 has defined an alternate signal stack (using sigalt‐
166 stack(2)), then that stack is installed.
167
168 (1.3) Various pieces of signal-related context are saved into a
169 special frame that is created on the stack. The saved in‐
170 formation includes:
171
172 • the program counter register (i.e., the address of the
173 next instruction in the main program that should be exe‐
174 cuted when the signal handler returns);
175
176 • architecture-specific register state required for resum‐
177 ing the interrupted program;
178
179 • the thread's current signal mask;
180
181 • the thread's alternate signal stack settings.
182
183 (If the signal handler was installed using the sigaction(2)
184 SA_SIGINFO flag, then the above information is accessible
185 via the ucontext_t object that is pointed to by the third
186 argument of the signal handler.)
187
188 (1.4) Any signals specified in act->sa_mask when registering the
189 handler with sigprocmask(2) are added to the thread's sig‐
190 nal mask. The signal being delivered is also added to the
191 signal mask, unless SA_NODEFER was specified when register‐
192 ing the handler. These signals are thus blocked while the
193 handler executes.
194
195 (2) The kernel constructs a frame for the signal handler on the stack.
196 The kernel sets the program counter for the thread to point to the
197 first instruction of the signal handler function, and configures
198 the return address for that function to point to a piece of user-
199 space code known as the signal trampoline (described in sigre‐
200 turn(2)).
201
202 (3) The kernel passes control back to user-space, where execution com‐
203 mences at the start of the signal handler function.
204
205 (4) When the signal handler returns, control passes to the signal
206 trampoline code.
207
208 (5) The signal trampoline calls sigreturn(2), a system call that uses
209 the information in the stack frame created in step 1 to restore
210 the thread to its state before the signal handler was called. The
211 thread's signal mask and alternate signal stack settings are re‐
212 stored as part of this procedure. Upon completion of the call to
213 sigreturn(2), the kernel transfers control back to user space, and
214 the thread recommences execution at the point where it was inter‐
215 rupted by the signal handler.
216
217 Note that if the signal handler does not return (e.g., control is
218 transferred out of the handler using siglongjmp(3), or the handler exe‐
219 cutes a new program with execve(2)), then the final step is not per‐
220 formed. In particular, in such scenarios it is the programmer's re‐
221 sponsibility to restore the state of the signal mask (using sigproc‐
222 mask(2)), if it is desired to unblock the signals that were blocked on
223 entry to the signal handler. (Note that siglongjmp(3) may or may not
224 restore the signal mask, depending on the savesigs value that was spec‐
225 ified in the corresponding call to sigsetjmp(3).)
226
227 From the kernel's point of view, execution of the signal handler code
228 is exactly the same as the execution of any other user-space code.
229 That is to say, the kernel does not record any special state informa‐
230 tion indicating that the thread is currently executing inside a signal
231 handler. All necessary state information is maintained in user-space
232 registers and the user-space stack. The depth to which nested signal
233 handlers may be invoked is thus limited only by the user-space stack
234 (and sensible software design!).
235
236 Standard signals
237 Linux supports the standard signals listed below. The second column of
238 the table indicates which standard (if any) specified the signal:
239 "P1990" indicates that the signal is described in the original
240 POSIX.1-1990 standard; "P2001" indicates that the signal was added in
241 SUSv2 and POSIX.1-2001.
242
243 Signal Standard Action Comment
244 ────────────────────────────────────────────────────────────────────────
245 SIGABRT P1990 Core Abort signal from abort(3)
246 SIGALRM P1990 Term Timer signal from alarm(2)
247 SIGBUS P2001 Core Bus error (bad memory access)
248 SIGCHLD P1990 Ign Child stopped or terminated
249 SIGCLD - Ign A synonym for SIGCHLD
250 SIGCONT P1990 Cont Continue if stopped
251 SIGEMT - Term Emulator trap
252 SIGFPE P1990 Core Floating-point exception
253 SIGHUP P1990 Term Hangup detected on controlling terminal
254 or death of controlling process
255 SIGILL P1990 Core Illegal Instruction
256 SIGINFO - A synonym for SIGPWR
257 SIGINT P1990 Term Interrupt from keyboard
258 SIGIO - Term I/O now possible (4.2BSD)
259 SIGIOT - Core IOT trap. A synonym for SIGABRT
260 SIGKILL P1990 Term Kill signal
261 SIGLOST - Term File lock lost (unused)
262 SIGPIPE P1990 Term Broken pipe: write to pipe with no
263 readers; see pipe(7)
264
265 SIGPOLL P2001 Term Pollable event (Sys V);
266 synonym for SIGIO
267 SIGPROF P2001 Term Profiling timer expired
268 SIGPWR - Term Power failure (System V)
269 SIGQUIT P1990 Core Quit from keyboard
270 SIGSEGV P1990 Core Invalid memory reference
271 SIGSTKFLT - Term Stack fault on coprocessor (unused)
272 SIGSTOP P1990 Stop Stop process
273 SIGTSTP P1990 Stop Stop typed at terminal
274 SIGSYS P2001 Core Bad system call (SVr4);
275 see also seccomp(2)
276 SIGTERM P1990 Term Termination signal
277 SIGTRAP P2001 Core Trace/breakpoint trap
278 SIGTTIN P1990 Stop Terminal input for background process
279 SIGTTOU P1990 Stop Terminal output for background process
280 SIGUNUSED - Core Synonymous with SIGSYS
281 SIGURG P2001 Ign Urgent condition on socket (4.2BSD)
282 SIGUSR1 P1990 Term User-defined signal 1
283 SIGUSR2 P1990 Term User-defined signal 2
284 SIGVTALRM P2001 Term Virtual alarm clock (4.2BSD)
285 SIGXCPU P2001 Core CPU time limit exceeded (4.2BSD);
286 see setrlimit(2)
287 SIGXFSZ P2001 Core File size limit exceeded (4.2BSD);
288 see setrlimit(2)
289 SIGWINCH - Ign Window resize signal (4.3BSD, Sun)
290
291 The signals SIGKILL and SIGSTOP cannot be caught, blocked, or ignored.
292
293 Up to and including Linux 2.2, the default behavior for SIGSYS, SIGX‐
294 CPU, SIGXFSZ, and (on architectures other than SPARC and MIPS) SIGBUS
295 was to terminate the process (without a core dump). (On some other
296 UNIX systems the default action for SIGXCPU and SIGXFSZ is to terminate
297 the process without a core dump.) Linux 2.4 conforms to the
298 POSIX.1-2001 requirements for these signals, terminating the process
299 with a core dump.
300
301 SIGEMT is not specified in POSIX.1-2001, but nevertheless appears on
302 most other UNIX systems, where its default action is typically to ter‐
303 minate the process with a core dump.
304
305 SIGPWR (which is not specified in POSIX.1-2001) is typically ignored by
306 default on those other UNIX systems where it appears.
307
308 SIGIO (which is not specified in POSIX.1-2001) is ignored by default on
309 several other UNIX systems.
310
311 Queueing and delivery semantics for standard signals
312 If multiple standard signals are pending for a process, the order in
313 which the signals are delivered is unspecified.
314
315 Standard signals do not queue. If multiple instances of a standard
316 signal are generated while that signal is blocked, then only one in‐
317 stance of the signal is marked as pending (and the signal will be de‐
318 livered just once when it is unblocked). In the case where a standard
319 signal is already pending, the siginfo_t structure (see sigaction(2))
320 associated with that signal is not overwritten on arrival of subsequent
321 instances of the same signal. Thus, the process will receive the in‐
322 formation associated with the first instance of the signal.
323
324 Signal numbering for standard signals
325 The numeric value for each signal is given in the table below. As
326 shown in the table, many signals have different numeric values on dif‐
327 ferent architectures. The first numeric value in each table row shows
328 the signal number on x86, ARM, and most other architectures; the second
329 value is for Alpha and SPARC; the third is for MIPS; and the last is
330 for PARISC. A dash (-) denotes that a signal is absent on the corre‐
331 sponding architecture.
332
333 Signal x86/ARM Alpha/ MIPS PARISC Notes
334 most others SPARC
335 ─────────────────────────────────────────────────────────────────
336 SIGHUP 1 1 1 1
337 SIGINT 2 2 2 2
338 SIGQUIT 3 3 3 3
339 SIGILL 4 4 4 4
340 SIGTRAP 5 5 5 5
341 SIGABRT 6 6 6 6
342 SIGIOT 6 6 6 6
343 SIGBUS 7 10 10 10
344 SIGEMT - 7 7 -
345 SIGFPE 8 8 8 8
346 SIGKILL 9 9 9 9
347 SIGUSR1 10 30 16 16
348 SIGSEGV 11 11 11 11
349 SIGUSR2 12 31 17 17
350 SIGPIPE 13 13 13 13
351 SIGALRM 14 14 14 14
352 SIGTERM 15 15 15 15
353 SIGSTKFLT 16 - - 7
354 SIGCHLD 17 20 18 18
355 SIGCLD - - 18 -
356 SIGCONT 18 19 25 26
357 SIGSTOP 19 17 23 24
358 SIGTSTP 20 18 24 25
359 SIGTTIN 21 21 26 27
360 SIGTTOU 22 22 27 28
361 SIGURG 23 16 21 29
362 SIGXCPU 24 24 30 12
363 SIGXFSZ 25 25 31 30
364 SIGVTALRM 26 26 28 20
365 SIGPROF 27 27 29 21
366 SIGWINCH 28 28 20 23
367 SIGIO 29 23 22 22
368 SIGPOLL Same as SIGIO
369 SIGPWR 30 29/- 19 19
370 SIGINFO - 29/- - -
371 SIGLOST - -/29 - -
372 SIGSYS 31 12 12 31
373 SIGUNUSED 31 - - 31
374
375 Note the following:
376
377 • Where defined, SIGUNUSED is synonymous with SIGSYS. Since glibc
378 2.26, SIGUNUSED is no longer defined on any architecture.
379
380 • Signal 29 is SIGINFO/SIGPWR (synonyms for the same value) on Alpha
381 but SIGLOST on SPARC.
382
383 Real-time signals
384 Starting with Linux 2.2, Linux supports real-time signals as originally
385 defined in the POSIX.1b real-time extensions (and now included in
386 POSIX.1-2001). The range of supported real-time signals is defined by
387 the macros SIGRTMIN and SIGRTMAX. POSIX.1-2001 requires that an imple‐
388 mentation support at least _POSIX_RTSIG_MAX (8) real-time signals.
389
390 The Linux kernel supports a range of 33 different real-time signals,
391 numbered 32 to 64. However, the glibc POSIX threads implementation in‐
392 ternally uses two (for NPTL) or three (for LinuxThreads) real-time sig‐
393 nals (see pthreads(7)), and adjusts the value of SIGRTMIN suitably (to
394 34 or 35). Because the range of available real-time signals varies ac‐
395 cording to the glibc threading implementation (and this variation can
396 occur at run time according to the available kernel and glibc), and in‐
397 deed the range of real-time signals varies across UNIX systems, pro‐
398 grams should never refer to real-time signals using hard-coded numbers,
399 but instead should always refer to real-time signals using the notation
400 SIGRTMIN+n, and include suitable (run-time) checks that SIGRTMIN+n does
401 not exceed SIGRTMAX.
402
403 Unlike standard signals, real-time signals have no predefined meanings:
404 the entire set of real-time signals can be used for application-defined
405 purposes.
406
407 The default action for an unhandled real-time signal is to terminate
408 the receiving process.
409
410 Real-time signals are distinguished by the following:
411
412 • Multiple instances of real-time signals can be queued. By contrast,
413 if multiple instances of a standard signal are delivered while that
414 signal is currently blocked, then only one instance is queued.
415
416 • If the signal is sent using sigqueue(3), an accompanying value (ei‐
417 ther an integer or a pointer) can be sent with the signal. If the
418 receiving process establishes a handler for this signal using the
419 SA_SIGINFO flag to sigaction(2), then it can obtain this data via
420 the si_value field of the siginfo_t structure passed as the second
421 argument to the handler. Furthermore, the si_pid and si_uid fields
422 of this structure can be used to obtain the PID and real user ID of
423 the process sending the signal.
424
425 • Real-time signals are delivered in a guaranteed order. Multiple
426 real-time signals of the same type are delivered in the order they
427 were sent. If different real-time signals are sent to a process,
428 they are delivered starting with the lowest-numbered signal. (I.e.,
429 low-numbered signals have highest priority.) By contrast, if multi‐
430 ple standard signals are pending for a process, the order in which
431 they are delivered is unspecified.
432
433 If both standard and real-time signals are pending for a process, POSIX
434 leaves it unspecified which is delivered first. Linux, like many other
435 implementations, gives priority to standard signals in this case.
436
437 According to POSIX, an implementation should permit at least
438 _POSIX_SIGQUEUE_MAX [22m(32) real-time signals to be queued to a process.
439 However, Linux does things differently. Up to and including Linux
440 2.6.7, Linux imposes a system-wide limit on the number of queued real-
441 time signals for all processes. This limit can be viewed and (with
442 privilege) changed via the /proc/sys/kernel/rtsig-max file. A related
443 file, /proc/sys/kernel/rtsig-nr, can be used to find out how many real-
444 time signals are currently queued. In Linux 2.6.8, these /proc inter‐
445 faces were replaced by the RLIMIT_SIGPENDING resource limit, which
446 specifies a per-user limit for queued signals; see setrlimit(2) for
447 further details.
448
449 The addition of real-time signals required the widening of the signal
450 set structure (sigset_t) from 32 to 64 bits. Consequently, various
451 system calls were superseded by new system calls that supported the
452 larger signal sets. The old and new system calls are as follows:
453
454 Linux 2.0 and earlier Linux 2.2 and later
455 sigaction(2) rt_sigaction(2)
456 sigpending(2) rt_sigpending(2)
457 sigprocmask(2) rt_sigprocmask(2)
458 sigreturn(2) rt_sigreturn(2)
459 sigsuspend(2) rt_sigsuspend(2)
460 sigtimedwait(2) rt_sigtimedwait(2)
461
462 Interruption of system calls and library functions by signal handlers
463 If a signal handler is invoked while a system call or library function
464 call is blocked, then either:
465
466 • the call is automatically restarted after the signal handler re‐
467 turns; or
468
469 • the call fails with the error EINTR.
470
471 Which of these two behaviors occurs depends on the interface and
472 whether or not the signal handler was established using the SA_RESTART
473 flag (see sigaction(2)). The details vary across UNIX systems; below,
474 the details for Linux.
475
476 If a blocked call to one of the following interfaces is interrupted by
477 a signal handler, then the call is automatically restarted after the
478 signal handler returns if the SA_RESTART flag was used; otherwise the
479 call fails with the error EINTR:
480
481 • read(2), readv(2), write(2), writev(2), and ioctl(2) calls on "slow"
482 devices. A "slow" device is one where the I/O call may block for an
483 indefinite time, for example, a terminal, pipe, or socket. If an
484 I/O call on a slow device has already transferred some data by the
485 time it is interrupted by a signal handler, then the call will re‐
486 turn a success status (normally, the number of bytes transferred).
487 Note that a (local) disk is not a slow device according to this def‐
488 inition; I/O operations on disk devices are not interrupted by sig‐
489 nals.
490
491 • open(2), if it can block (e.g., when opening a FIFO; see fifo(7)).
492
493 • wait(2), wait3(2), wait4(2), waitid(2), and waitpid(2).
494
495 • Socket interfaces: accept(2), connect(2), recv(2), recvfrom(2),
496 recvmmsg(2), recvmsg(2), send(2), sendto(2), and sendmsg(2), unless
497 a timeout has been set on the socket (see below).
498
499 • File locking interfaces: flock(2) and the F_SETLKW and F_OFD_SETLKW
500 operations of fcntl(2)
501
502 • POSIX message queue interfaces: mq_receive(3), mq_timedreceive(3),
503 mq_send(3), and mq_timedsend(3).
504
505 • futex(2) FUTEX_WAIT (since Linux 2.6.22; beforehand, always failed
506 with EINTR).
507
508 • getrandom(2).
509
510 • pthread_mutex_lock(3), pthread_cond_wait(3), and related APIs.
511
512 • futex(2) FUTEX_WAIT_BITSET.
513
514 • POSIX semaphore interfaces: sem_wait(3) and sem_timedwait(3) (since
515 Linux 2.6.22; beforehand, always failed with EINTR).
516
517 • read(2) from an inotify(7) file descriptor (since Linux 3.8; before‐
518 hand, always failed with EINTR).
519
520 The following interfaces are never restarted after being interrupted by
521 a signal handler, regardless of the use of SA_RESTART; they always fail
522 with the error EINTR when interrupted by a signal handler:
523
524 • "Input" socket interfaces, when a timeout (SO_RCVTIMEO) has been set
525 on the socket using setsockopt(2): accept(2), recv(2), recvfrom(2),
526 recvmmsg(2) (also with a non-NULL timeout argument), and recvmsg(2).
527
528 • "Output" socket interfaces, when a timeout (SO_RCVTIMEO) has been
529 set on the socket using setsockopt(2): connect(2), send(2),
530 sendto(2), and sendmsg(2).
531
532 • Interfaces used to wait for signals: pause(2), sigsuspend(2), sig‐
533 timedwait(2), and sigwaitinfo(2).
534
535 • File descriptor multiplexing interfaces: epoll_wait(2),
536 epoll_pwait(2), poll(2), ppoll(2), select(2), and pselect(2).
537
538 • System V IPC interfaces: msgrcv(2), msgsnd(2), semop(2), and sem‐
539 timedop(2).
540
541 • Sleep interfaces: clock_nanosleep(2), nanosleep(2), and usleep(3).
542
543 • io_getevents(2).
544
545 The sleep(3) function is also never restarted if interrupted by a han‐
546 dler, but gives a success return: the number of seconds remaining to
547 sleep.
548
549 In certain circumstances, the seccomp(2) user-space notification fea‐
550 ture can lead to restarting of system calls that would otherwise never
551 be restarted by SA_RESTART; for details, see seccomp_unotify(2).
552
553 Interruption of system calls and library functions by stop signals
554 On Linux, even in the absence of signal handlers, certain blocking in‐
555 terfaces can fail with the error EINTR after the process is stopped by
556 one of the stop signals and then resumed via SIGCONT. This behavior is
557 not sanctioned by POSIX.1, and doesn't occur on other systems.
558
559 The Linux interfaces that display this behavior are:
560
561 • "Input" socket interfaces, when a timeout (SO_RCVTIMEO) has been set
562 on the socket using setsockopt(2): accept(2), recv(2), recvfrom(2),
563 recvmmsg(2) (also with a non-NULL timeout argument), and recvmsg(2).
564
565 • "Output" socket interfaces, when a timeout (SO_RCVTIMEO) has been
566 set on the socket using setsockopt(2): connect(2), send(2),
567 sendto(2), and sendmsg(2), if a send timeout (SO_SNDTIMEO) has been
568 set.
569
570 • epoll_wait(2), epoll_pwait(2).
571
572 • semop(2), semtimedop(2).
573
574 • sigtimedwait(2), sigwaitinfo(2).
575
576 • Linux 3.7 and earlier: read(2) from an inotify(7) file descriptor
577
578 • Linux 2.6.21 and earlier: futex(2) FUTEX_WAIT, sem_timedwait(3),
579 sem_wait(3).
580
581 • Linux 2.6.8 and earlier: msgrcv(2), msgsnd(2).
582
583 • Linux 2.4 and earlier: nanosleep(2).
584
586 POSIX.1, except as noted.
587
589 For a discussion of async-signal-safe functions, see signal-safety(7).
590
591 The /proc/pid/task/tid/status file contains various fields that show
592 the signals that a thread is blocking (SigBlk), catching (SigCgt), or
593 ignoring (SigIgn). (The set of signals that are caught or ignored will
594 be the same across all threads in a process.) Other fields show the
595 set of pending signals that are directed to the thread (SigPnd) as well
596 as the set of pending signals that are directed to the process as a
597 whole (ShdPnd). The corresponding fields in /proc/pid/status show the
598 information for the main thread. See proc(5) for further details.
599
601 There are six signals that can be delivered as a consequence of a hard‐
602 ware exception: SIGBUS, SIGEMT, SIGFPE, SIGILL, SIGSEGV, and SIGTRAP.
603 Which of these signals is delivered, for any given hardware exception,
604 is not documented and does not always make sense.
605
606 For example, an invalid memory access that causes delivery of SIGSEGV
607 on one CPU architecture may cause delivery of SIGBUS on another archi‐
608 tecture, or vice versa.
609
610 For another example, using the x86 int instruction with a forbidden ar‐
611 gument (any number other than 3 or 128) causes delivery of SIGSEGV,
612 even though SIGILL would make more sense, because of how the CPU re‐
613 ports the forbidden operation to the kernel.
614
616 kill(1), clone(2), getrlimit(2), kill(2), pidfd_send_signal(2),
617 restart_syscall(2), rt_sigqueueinfo(2), setitimer(2), setrlimit(2),
618 sgetmask(2), sigaction(2), sigaltstack(2), signal(2), signalfd(2), sig‐
619 pending(2), sigprocmask(2), sigreturn(2), sigsuspend(2), sigwait‐
620 info(2), abort(3), bsd_signal(3), killpg(3), longjmp(3),
621 pthread_sigqueue(3), raise(3), sigqueue(3), sigset(3), sigsetops(3),
622 sigvec(3), sigwait(3), strsignal(3), swapcontext(3), sysv_signal(3),
623 core(5), proc(5), nptl(7), pthreads(7), sigevent(7)
624
625
626
627Linux man-pages 6.05 2023-04-03 signal(7)