OSDN Git Service

(split) LDP: Update original to LDP v3.41.
[linuxjm/LDP_man-pages.git] / original / man7 / signal.7
1 '\" t
2 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
3 .\" and Copyright (c) 2002, 2006 by Michael Kerrisk <mtk.manpages@gmail.com>
4 .\" and Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
5 .\"     <mtk.manpages@gmail.com>
6 .\"
7 .\" Permission is granted to make and distribute verbatim copies of this
8 .\" manual provided the copyright notice and this permission notice are
9 .\" preserved on all copies.
10 .\"
11 .\" Permission is granted to copy and distribute modified versions of this
12 .\" manual under the conditions for verbatim copying, provided that the
13 .\" entire resulting derived work is distributed under the terms of a
14 .\" permission notice identical to this one.
15 .\"
16 .\" Since the Linux kernel and libraries are constantly changing, this
17 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
18 .\" responsibility for errors or omissions, or for damages resulting from
19 .\" the use of the information contained herein.  The author(s) may not
20 .\" have taken the same level of care in the production of this manual,
21 .\" which is licensed free of charge, as they might when working
22 .\" professionally.
23 .\"
24 .\" Formatted or processed versions of this manual, if unaccompanied by
25 .\" the source, must acknowledge the copyright and authors of this work.
26 .\"
27 .\" Modified Sat Jul 24 17:34:08 1993 by Rik Faith (faith@cs.unc.edu)
28 .\" Modified Sun Jan  7 01:41:27 1996 by Andries Brouwer (aeb@cwi.nl)
29 .\" Modified Sun Apr 14 12:02:29 1996 by Andries Brouwer (aeb@cwi.nl)
30 .\" Modified Sat Nov 13 16:28:23 1999 by Andries Brouwer (aeb@cwi.nl)
31 .\" Modified 10 Apr 2002, by Michael Kerrisk <mtk.manpages@gmail.com>
32 .\" Modified  7 Jun 2002, by Michael Kerrisk <mtk.manpages@gmail.com>
33 .\"     Added information on real-time signals
34 .\" Modified 13 Jun 2002, by Michael Kerrisk <mtk.manpages@gmail.com>
35 .\"     Noted that SIGSTKFLT is in fact unused
36 .\" 2004-12-03, Modified mtk, added notes on RLIMIT_SIGPENDING
37 .\" 2006-04-24, mtk, Added text on changing signal dispositions,
38 .\"             signal mask, and pending signals.
39 .\" 2008-07-04, mtk:
40 .\"     Added section on system call restarting (SA_RESTART)
41 .\"     Added section on stop/cont signals interrupting syscalls.
42 .\" 2008-10-05, mtk: various additions
43 .\"
44 .TH SIGNAL 7  2012-05-01 "Linux" "Linux Programmer's Manual"
45 .SH NAME
46 signal \- overview of signals
47 .SH DESCRIPTION
48 Linux supports both POSIX reliable signals (hereinafter
49 "standard signals") and POSIX real-time signals.
50 .SS "Signal Dispositions"
51 Each signal has a current
52 .IR disposition ,
53 which determines how the process behaves when it is delivered
54 the signal.
55
56 The entries in the "Action" column of the tables below specify
57 the default disposition for each signal, as follows:
58 .IP Term
59 Default action is to terminate the process.
60 .IP Ign
61 Default action is to ignore the signal.
62 .IP Core
63 Default action is to terminate the process and dump core (see
64 .BR core (5)).
65 .IP Stop
66 Default action is to stop the process.
67 .IP Cont
68 Default action is to continue the process if it is currently stopped.
69 .PP
70 A process can change the disposition of a signal using
71 .BR sigaction (2)
72 or
73 .BR signal (2).
74 (The latter is less portable when establishing a signal handler;
75 see
76 .BR signal (2)
77 for details.)
78 Using these system calls, a process can elect one of the
79 following behaviors to occur on delivery of the signal:
80 perform the default action; ignore the signal;
81 or catch the signal with a
82 .IR "signal handler" ,
83 a programmer-defined function that is automatically invoked
84 when the signal is delivered.
85 (By default, the signal handler is invoked on the
86 normal process stack.
87 It is possible to arrange that the signal handler
88 uses an alternate stack; see
89 .BR sigaltstack (2)
90 for a discussion of how to do this and when it might be useful.)
91
92 The signal disposition is a per-process attribute:
93 in a multithreaded application, the disposition of a
94 particular signal is the same for all threads.
95
96 A child created via
97 .BR fork (2)
98 inherits a copy of its parent's signal dispositions.
99 During an
100 .BR execve (2),
101 the dispositions of handled signals are reset to the default;
102 the dispositions of ignored signals are left unchanged.
103 .SS Sending a Signal
104 The following system calls and library functions allow
105 the caller to send a signal:
106 .TP 16
107 .BR raise (3)
108 Sends a signal to the calling thread.
109 .TP
110 .BR kill (2)
111 Sends a signal to a specified process,
112 to all members of a specified process group,
113 or to all processes on the system.
114 .TP
115 .BR killpg (2)
116 Sends a signal to all of the members of a specified process group.
117 .TP
118 .BR pthread_kill (3)
119 Sends a signal to a specified POSIX thread in the same process as
120 the caller.
121 .TP
122 .BR tgkill (2)
123 Sends a signal to a specified thread within a specific process.
124 (This is the system call used to implement
125 .BR pthread_kill (3).)
126 .TP
127 .BR sigqueue (3)
128 Sends a real-time signal with accompanying data to a specified process.
129 .SS Waiting for a Signal to be Caught
130 The following system calls suspend execution of the calling process
131 or thread until a signal is caught
132 (or an unhandled signal terminates the process):
133 .TP 16
134 .BR pause (2)
135 Suspends execution until any signal is caught.
136 .TP
137 .BR sigsuspend (2)
138 Temporarily changes the signal mask (see below) and suspends
139 execution until one of the unmasked signals is caught.
140 .SS Synchronously Accepting a Signal
141 Rather than asynchronously catching a signal via a signal handler,
142 it is possible to synchronously accept the signal, that is,
143 to block execution until the signal is delivered,
144 at which point the kernel returns information about the
145 signal to the caller.
146 There are two general ways to do this:
147 .IP * 2
148 .BR sigwaitinfo (2),
149 .BR sigtimedwait (2),
150 and
151 .BR sigwait (3)
152 suspend execution until one of the signals in a specified
153 set is delivered.
154 Each of these calls returns information about the delivered signal.
155 .IP *
156 .BR signalfd (2)
157 returns a file descriptor that can be used to read information
158 about signals that are delivered to the caller.
159 Each
160 .BR read (2)
161 from this file descriptor blocks until one of the signals
162 in the set specified in the
163 .BR signalfd (2)
164 call is delivered to the caller.
165 The buffer returned by
166 .BR read (2)
167 contains a structure describing the signal.
168 .SS "Signal Mask and Pending Signals"
169 A signal may be
170 .IR blocked ,
171 which means that it will not be delivered until it is later unblocked.
172 Between the time when it is generated and when it is delivered
173 a signal is said to be
174 .IR pending .
175
176 Each thread in a process has an independent
177 .IR "signal mask" ,
178 which indicates the set of signals that the thread is currently blocking.
179 A thread can manipulate its signal mask using
180 .BR pthread_sigmask (3).
181 In a traditional single-threaded application,
182 .BR sigprocmask (2)
183 can be used to manipulate the signal mask.
184
185 A child created via
186 .BR fork (2)
187 inherits a copy of its parent's signal mask;
188 the signal mask is preserved across
189 .BR execve (2).
190
191 A signal may be generated (and thus pending)
192 for a process as a whole (e.g., when sent using
193 .BR kill (2))
194 or for a specific thread (e.g., certain signals,
195 such as
196 .B SIGSEGV
197 and
198 .BR SIGFPE ,
199 generated as a
200 consequence of executing a specific machine-language instruction
201 are thread directed, as are signals targeted at a specific thread using
202 .BR pthread_kill (3)).
203 A process-directed signal may be delivered to any one of the
204 threads that does not currently have the signal blocked.
205 If more than one of the threads has the signal unblocked, then the
206 kernel chooses an arbitrary thread to which to deliver the signal.
207
208 A thread can obtain the set of signals that it currently has pending
209 using
210 .BR sigpending (2).
211 This set will consist of the union of the set of pending
212 process-directed signals and the set of signals pending for
213 the calling thread.
214
215 A child created via
216 .BR fork (2)
217 initially has an empty pending signal set;
218 the pending signal set is preserved across an
219 .BR execve (2).
220 .SS "Standard Signals"
221 Linux supports the standard signals listed below.
222 Several signal numbers
223 are architecture-dependent, as indicated in the "Value" column.
224 (Where three values are given, the first one is usually valid for
225 alpha and sparc,
226 the middle one for x86, arm, and most other architectures,
227 and the last one for mips.
228 (Values for parisc are
229 .I not
230 shown; see the kernel source for signal numbering on that architecture.)
231 A \- denotes that a signal is absent on the corresponding architecture.)
232
233 First the signals described in the original POSIX.1-1990 standard.
234 .TS
235 l c c l
236 ____
237 lB c c l.
238 Signal  Value   Action  Comment
239 SIGHUP  \01     Term    Hangup detected on controlling terminal
240                         or death of controlling process
241 SIGINT  \02     Term    Interrupt from keyboard
242 SIGQUIT \03     Core    Quit from keyboard
243 SIGILL  \04     Core    Illegal Instruction
244 SIGABRT \06     Core    Abort signal from \fBabort\fP(3)
245 SIGFPE  \08     Core    Floating point exception
246 SIGKILL \09     Term    Kill signal
247 SIGSEGV 11      Core    Invalid memory reference
248 SIGPIPE 13      Term    Broken pipe: write to pipe with no
249                         readers
250 SIGALRM 14      Term    Timer signal from \fBalarm\fP(2)
251 SIGTERM 15      Term    Termination signal
252 SIGUSR1 30,10,16        Term    User-defined signal 1
253 SIGUSR2 31,12,17        Term    User-defined signal 2
254 SIGCHLD 20,17,18        Ign     Child stopped or terminated
255 SIGCONT 19,18,25        Cont    Continue if stopped
256 SIGSTOP 17,19,23        Stop    Stop process
257 SIGTSTP 18,20,24        Stop    Stop typed at tty
258 SIGTTIN 21,21,26        Stop    tty input for background process
259 SIGTTOU 22,22,27        Stop    tty output for background process
260 .TE
261
262 The signals
263 .B SIGKILL
264 and
265 .B SIGSTOP
266 cannot be caught, blocked, or ignored.
267
268 Next the signals not in the POSIX.1-1990 standard but described in
269 SUSv2 and POSIX.1-2001.
270 .TS
271 l c c l
272 ____
273 lB c c l.
274 Signal  Value   Action  Comment
275 SIGBUS  10,7,10 Core    Bus error (bad memory access)
276 SIGPOLL         Term    Pollable event (Sys V).
277                         Synonym for \fBSIGIO\fP
278 SIGPROF 27,27,29        Term    Profiling timer expired
279 SIGSYS  12,31,12        Core    Bad argument to routine (SVr4)
280 SIGTRAP 5       Core    Trace/breakpoint trap
281 SIGURG  16,23,21        Ign     Urgent condition on socket (4.2BSD)
282 SIGVTALRM       26,26,28        Term    Virtual alarm clock (4.2BSD)
283 SIGXCPU 24,24,30        Core    CPU time limit exceeded (4.2BSD)
284 SIGXFSZ 25,25,31        Core    File size limit exceeded (4.2BSD)
285 .TE
286
287 Up to and including Linux 2.2, the default behavior for
288 .BR SIGSYS ", " SIGXCPU ", " SIGXFSZ ", "
289 and (on architectures other than SPARC and MIPS)
290 .B SIGBUS
291 was to terminate the process (without a core dump).
292 (On some other UNIX systems the default action for
293 .BR SIGXCPU " and " SIGXFSZ
294 is to terminate the process without a core dump.)
295 Linux 2.4 conforms to the POSIX.1-2001 requirements for these signals,
296 terminating the process with a core dump.
297
298 Next various other signals.
299 .TS
300 l c c l
301 ____
302 lB c c l.
303 Signal  Value   Action  Comment
304 SIGIOT  6       Core    IOT trap. A synonym for \fBSIGABRT\fP
305 SIGEMT  7,\-,7  Term
306 SIGSTKFLT       \-,16,\-        Term    Stack fault on coprocessor (unused)
307 SIGIO   23,29,22        Term    I/O now possible (4.2BSD)
308 SIGCLD  \-,\-,18        Ign     A synonym for \fBSIGCHLD\fP
309 SIGPWR  29,30,19        Term    Power failure (System V)
310 SIGINFO 29,\-,\-                A synonym for \fBSIGPWR\fP
311 SIGLOST \-,\-,\-        Term    File lock lost (unused)
312 SIGWINCH        28,28,20        Ign     Window resize signal (4.3BSD, Sun)
313 SIGUNUSED       \-,31,\-        Core    Synonymous with \fBSIGSYS\fP
314 .TE
315
316 (Signal 29 is
317 .B SIGINFO
318 /
319 .B SIGPWR
320 on an alpha but
321 .B SIGLOST
322 on a sparc.)
323
324 .B SIGEMT
325 is not specified in POSIX.1-2001, but nevertheless appears
326 on most other UNIX systems,
327 where its default action is typically to terminate
328 the process with a core dump.
329
330 .B SIGPWR
331 (which is not specified in POSIX.1-2001) is typically ignored
332 by default on those other UNIX systems where it appears.
333
334 .B SIGIO
335 (which is not specified in POSIX.1-2001) is ignored by default
336 on several other UNIX systems.
337
338 Where defined,
339 .B SIGUNUSED
340 is synonymous with
341 .\" parisc is the only exception: SIGSYS is 12, SIGUNUSED is 31
342 .B SIGSYS
343 on most architectures.
344 .SS "Real-time Signals"
345 Linux supports real-time signals as originally defined in the POSIX.1b
346 real-time extensions (and now included in POSIX.1-2001).
347 The range of supported real-time signals is defined by the macros
348 .B SIGRTMIN
349 and
350 .BR SIGRTMAX .
351 POSIX.1-2001 requires that an implementation support at least
352 .B _POSIX_RTSIG_MAX
353 (8) real-time signals.
354 .PP
355 The Linux kernel supports a range of 32 different real-time
356 signals, numbered 33 to 64.
357 However, the glibc POSIX threads implementation internally uses
358 two (for NPTL) or three (for LinuxThreads) real-time signals
359 (see
360 .BR pthreads (7)),
361 and adjusts the value of
362 .B SIGRTMIN
363 suitably (to 34 or 35).
364 Because the range of available real-time signals varies according
365 to the glibc threading implementation (and this variation can occur
366 at run time according to the available kernel and glibc),
367 and indeed the range of real-time signals varies across UNIX systems,
368 programs should
369 .IR "never refer to real-time signals using hard-coded numbers" ,
370 but instead should always refer to real-time signals using the notation
371 .BR SIGRTMIN +n,
372 and include suitable (run-time) checks that
373 .BR SIGRTMIN +n
374 does not exceed
375 .BR SIGRTMAX .
376 .PP
377 Unlike standard signals, real-time signals have no predefined meanings:
378 the entire set of real-time signals can be used for application-defined
379 purposes.
380 .PP
381 The default action for an unhandled real-time signal is to terminate the
382 receiving process.
383 .PP
384 Real-time signals are distinguished by the following:
385 .IP 1. 4
386 Multiple instances of real-time signals can be queued.
387 By contrast, if multiple instances of a standard signal are delivered
388 while that signal is currently blocked, then only one instance is queued.
389 .IP 2. 4
390 If the signal is sent using
391 .BR sigqueue (3),
392 an accompanying value (either an integer or a pointer) can be sent
393 with the signal.
394 If the receiving process establishes a handler for this signal using the
395 .B SA_SIGINFO
396 flag to
397 .BR sigaction (2)
398 then it can obtain this data via the
399 .I si_value
400 field of the
401 .I siginfo_t
402 structure passed as the second argument to the handler.
403 Furthermore, the
404 .I si_pid
405 and
406 .I si_uid
407 fields of this structure can be used to obtain the PID
408 and real user ID of the process sending the signal.
409 .IP 3. 4
410 Real-time signals are delivered in a guaranteed order.
411 Multiple real-time signals of the same type are delivered in the order
412 they were sent.
413 If different real-time signals are sent to a process, they are delivered
414 starting with the lowest-numbered signal.
415 (I.e., low-numbered signals have highest priority.)
416 By contrast, if multiple standard signals are pending for a process,
417 the order in which they are delivered is unspecified.
418 .PP
419 If both standard and real-time signals are pending for a process,
420 POSIX leaves it unspecified which is delivered first.
421 Linux, like many other implementations, gives priority
422 to standard signals in this case.
423 .PP
424 According to POSIX, an implementation should permit at least
425 .B _POSIX_SIGQUEUE_MAX
426 (32) real-time signals to be queued to
427 a process.
428 However, Linux does things differently.
429 In kernels up to and including 2.6.7, Linux imposes
430 a system-wide limit on the number of queued real-time signals
431 for all processes.
432 This limit can be viewed and (with privilege) changed via the
433 .I /proc/sys/kernel/rtsig-max
434 file.
435 A related file,
436 .IR /proc/sys/kernel/rtsig-nr ,
437 can be used to find out how many real-time signals are currently queued.
438 In Linux 2.6.8, these
439 .I /proc
440 interfaces were replaced by the
441 .B RLIMIT_SIGPENDING
442 resource limit, which specifies a per-user limit for queued
443 signals; see
444 .BR setrlimit (2)
445 for further details.
446 .SS "Async-signal-safe functions"
447 .PP
448 A signal handler function must be very careful,
449 since processing elsewhere may be interrupted
450 at some arbitrary point in the execution of the program.
451 POSIX has the concept of "safe function".
452 If a signal interrupts the execution of an unsafe function, and
453 .I handler
454 calls an unsafe function, then the behavior of the program is undefined.
455
456 POSIX.1-2004 (also known as POSIX.1-2001 Technical Corrigendum 2)
457 requires an implementation to guarantee that the following
458 functions can be safely called inside a signal handler:
459
460 .in +4
461 .nf
462 _Exit()
463 _exit()
464 abort()
465 accept()
466 access()
467 aio_error()
468 aio_return()
469 aio_suspend()
470 alarm()
471 bind()
472 cfgetispeed()
473 cfgetospeed()
474 cfsetispeed()
475 cfsetospeed()
476 chdir()
477 chmod()
478 chown()
479 clock_gettime()
480 close()
481 connect()
482 creat()
483 dup()
484 dup2()
485 execle()
486 execve()
487 fchmod()
488 fchown()
489 fcntl()
490 fdatasync()
491 fork()
492 fpathconf()
493 fstat()
494 fsync()
495 ftruncate()
496 getegid()
497 geteuid()
498 getgid()
499 getgroups()
500 getpeername()
501 getpgrp()
502 getpid()
503 getppid()
504 getsockname()
505 getsockopt()
506 getuid()
507 kill()
508 link()
509 listen()
510 lseek()
511 lstat()
512 mkdir()
513 mkfifo()
514 open()
515 pathconf()
516 pause()
517 pipe()
518 poll()
519 posix_trace_event()
520 pselect()
521 raise()
522 read()
523 readlink()
524 recv()
525 recvfrom()
526 recvmsg()
527 rename()
528 rmdir()
529 select()
530 sem_post()
531 send()
532 sendmsg()
533 sendto()
534 setgid()
535 setpgid()
536 setsid()
537 setsockopt()
538 setuid()
539 shutdown()
540 sigaction()
541 sigaddset()
542 sigdelset()
543 sigemptyset()
544 sigfillset()
545 sigismember()
546 signal()
547 sigpause()
548 sigpending()
549 sigprocmask()
550 sigqueue()
551 sigset()
552 sigsuspend()
553 sleep()
554 sockatmark()
555 socket()
556 socketpair()
557 stat()
558 symlink()
559 sysconf()
560 tcdrain()
561 tcflow()
562 tcflush()
563 tcgetattr()
564 tcgetpgrp()
565 tcsendbreak()
566 tcsetattr()
567 tcsetpgrp()
568 time()
569 timer_getoverrun()
570 timer_gettime()
571 timer_settime()
572 times()
573 umask()
574 uname()
575 unlink()
576 utime()
577 wait()
578 waitpid()
579 write()
580 .fi
581 .in
582 .PP
583 POSIX.1-2008 removes fpathconf(), pathconf(), and sysconf()
584 from the above list, and adds the following functions:
585 .PP
586 .in +4n
587 .nf
588 execl()
589 execv()
590 faccessat()
591 fchmodat()
592 fchownat()
593 fexecve()
594 fstatat()
595 futimens()
596 linkat()
597 mkdirat()
598 mkfifoat()
599 mknod()
600 mknodat()
601 openat()
602 readlinkat()
603 renameat()
604 symlinkat()
605 unlinkat()
606 utimensat()
607 utimes()
608 .fi
609 .in
610 .SS Interruption of System Calls and Library Functions by Signal Handlers
611 If a signal handler is invoked while a system call or library
612 function call is blocked, then either:
613 .IP * 2
614 the call is automatically restarted after the signal handler returns; or
615 .IP *
616 the call fails with the error
617 .BR EINTR .
618 .PP
619 Which of these two behaviors occurs depends on the interface and
620 whether or not the signal handler was established using the
621 .BR SA_RESTART
622 flag (see
623 .BR sigaction (2)).
624 The details vary across UNIX systems;
625 below, the details for Linux.
626
627 If a blocked call to one of the following interfaces is interrupted
628 by a signal handler, then the call will be automatically restarted
629 after the signal handler returns if the
630 .BR SA_RESTART
631 flag was used; otherwise the call will fail with the error
632 .BR EINTR :
633 .\" The following system calls use ERESTARTSYS,
634 .\" so that they are restartable
635 .RS 4
636 .IP * 2
637 .BR read (2),
638 .BR readv (2),
639 .BR write (2),
640 .BR writev (2),
641 and
642 .BR ioctl (2)
643 calls on "slow" devices.
644 A "slow" device is one where the I/O call may block for an
645 indefinite time, for example, a terminal, pipe, or socket.
646 (A disk is not a slow device according to this definition.)
647 If an I/O call on a slow device has already transferred some
648 data by the time it is interrupted by a signal handler,
649 then the call will return a success status
650 (normally, the number of bytes transferred).
651 .IP *
652 .BR open (2),
653 if it can block (e.g., when opening a FIFO; see
654 .BR fifo (7)).
655 .IP *
656 .BR wait (2),
657 .BR wait3 (2),
658 .BR wait4 (2),
659 .BR waitid (2),
660 and
661 .BR waitpid (2).
662 .IP *
663 Socket interfaces:
664 .\" If a timeout (setsockopt()) is in effect on the socket, then these
665 .\" system calls switch to using EINTR.  Consequently, they and are not
666 .\" automatically restarted, and they show the stop/cont behavior
667 .\" described below.  (Verified from 2.6.26 source, and by experiment; mtk)
668 .BR accept (2),
669 .BR connect (2),
670 .BR recv (2),
671 .BR recvfrom (2),
672 .BR recvmsg (2),
673 .BR send (2),
674 .BR sendto (2),
675 and
676 .BR sendmsg (2),
677 unless a timeout has been set on the socket (see below).
678 .IP *
679 File locking interfaces:
680 .BR flock (2)
681 and
682 .BR fcntl (2)
683 .BR F_SETLKW .
684 .IP *
685 POSIX message queue interfaces:
686 .BR mq_receive (3),
687 .BR mq_timedreceive (3),
688 .BR mq_send (3),
689 and
690 .BR mq_timedsend (3).
691 .IP *
692 .BR futex (2)
693 .B FUTEX_WAIT
694 (since Linux 2.6.22; beforehand, always failed with
695 .BR EINTR ).
696 .IP *
697 POSIX semaphore interfaces:
698 .BR sem_wait (3)
699 and
700 .BR sem_timedwait (3)
701 (since Linux 2.6.22; beforehand, always failed with
702 .BR EINTR ).
703 .RE
704 .PP
705 The following interfaces are never restarted after
706 being interrupted by a signal handler,
707 regardless of the use of
708 .BR SA_RESTART ;
709 they always fail with the error
710 .B EINTR
711 when interrupted by a signal handler:
712 .\" These are the system calls that give EINTR or ERESTARTNOHAND
713 .\" on interruption by a signal handler.
714 .RS 4
715 .IP * 2
716 Socket interfaces, when a timeout has been set on the socket using
717 .BR setsockopt (2):
718 .BR accept (2),
719 .BR recv (2),
720 .BR recvfrom (2),
721 and
722 .BR recvmsg (2),
723 if a receive timeout
724 .RB ( SO_RCVTIMEO )
725 has been set;
726 .BR connect (2),
727 .BR send (2),
728 .BR sendto (2),
729 and
730 .BR sendmsg (2),
731 if a send timeout
732 .RB ( SO_SNDTIMEO )
733 has been set.
734 .IP *
735 Interfaces used to wait for signals:
736 .BR pause (2),
737 .BR sigsuspend (2),
738 .BR sigtimedwait (2),
739 and
740 .BR sigwaitinfo (2).
741 .IP *
742 File descriptor multiplexing interfaces:
743 .BR epoll_wait (2),
744 .BR epoll_pwait (2),
745 .BR poll (2),
746 .BR ppoll (2),
747 .BR select (2),
748 and
749 .BR pselect (2).
750 .IP *
751 System V IPC interfaces:
752 .\" On some other systems, SA_RESTART does restart these system calls
753 .BR msgrcv (2),
754 .BR msgsnd (2),
755 .BR semop (2),
756 and
757 .BR semtimedop (2).
758 .IP *
759 Sleep interfaces:
760 .BR clock_nanosleep (2),
761 .BR nanosleep (2),
762 and
763 .BR usleep (3).
764 .IP *
765 .BR read (2)
766 from an
767 .BR inotify (7)
768 file descriptor.
769 .IP *
770 .BR io_getevents (2).
771 .RE
772 .PP
773 The
774 .BR sleep (3)
775 function is also never restarted if interrupted by a handler,
776 but gives a success return: the number of seconds remaining to sleep.
777 .SS Interruption of System Calls and Library Functions by Stop Signals
778 On Linux, even in the absence of signal handlers,
779 certain blocking interfaces can fail with the error
780 .BR EINTR
781 after the process is stopped by one of the stop signals
782 and then resumed via
783 .BR SIGCONT .
784 This behavior is not sanctioned by POSIX.1, and doesn't occur
785 on other systems.
786
787 The Linux interfaces that display this behavior are:
788 .RS 4
789 .IP * 2
790 Socket interfaces, when a timeout has been set on the socket using
791 .BR setsockopt (2):
792 .BR accept (2),
793 .BR recv (2),
794 .BR recvfrom (2),
795 and
796 .BR recvmsg (2),
797 if a receive timeout
798 .RB ( SO_RCVTIMEO )
799 has been set;
800 .BR connect (2),
801 .BR send (2),
802 .BR sendto (2),
803 and
804 .BR sendmsg (2),
805 if a send timeout
806 .RB ( SO_SNDTIMEO )
807 has been set.
808 .IP * 2
809 .BR epoll_wait (2),
810 .BR epoll_pwait (2).
811 .IP *
812 .BR semop (2),
813 .BR semtimedop (2).
814 .IP *
815 .BR sigtimedwait (2),
816 .BR sigwaitinfo (2).
817 .IP *
818 .BR read (2)
819 from an
820 .BR inotify (7)
821 file descriptor.
822 .IP *
823 Linux 2.6.21 and earlier:
824 .BR futex (2)
825 .BR FUTEX_WAIT ,
826 .BR sem_timedwait (3),
827 .BR sem_wait (3).
828 .IP *
829 Linux 2.6.8 and earlier:
830 .BR msgrcv (2),
831 .BR msgsnd (2).
832 .IP *
833 Linux 2.4 and earlier:
834 .BR nanosleep (2).
835 .RE
836 .SH "CONFORMING TO"
837 POSIX.1, except as noted.
838 .\" It must be a *very* long time since this was true:
839 .\" .SH BUGS
840 .\" .B SIGIO
841 .\" and
842 .\" .B SIGLOST
843 .\" have the same value.
844 .\" The latter is commented out in the kernel source, but
845 .\" the build process of some software still thinks that
846 .\" signal 29 is
847 .\" .BR SIGLOST .
848 .SH "SEE ALSO"
849 .BR kill (1),
850 .BR getrlimit (2),
851 .BR kill (2),
852 .BR killpg (2),
853 .BR rt_sigqueueinfo (2),
854 .BR setitimer (2),
855 .BR setrlimit (2),
856 .BR sgetmask (2),
857 .BR sigaction (2),
858 .BR sigaltstack (2),
859 .BR signal (2),
860 .BR signalfd (2),
861 .BR sigpending (2),
862 .BR sigprocmask (2),
863 .BR sigsuspend (2),
864 .BR sigwaitinfo (2),
865 .BR abort (3),
866 .BR bsd_signal (3),
867 .BR longjmp (3),
868 .BR raise (3),
869 .BR pthread_sigqueue (3),
870 .BR sigqueue (3),
871 .BR sigset (3),
872 .BR sigsetops (3),
873 .BR sigvec (3),
874 .BR sigwait (3),
875 .BR strsignal (3),
876 .BR sysv_signal (3),
877 .BR core (5),
878 .BR proc (5),
879 .BR pthreads (7),
880 .BR sigevent (7)