OSDN Git Service

(split) LDP_man-pages: update original to v3.34.
[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  2011-09-18 "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 ix86, ia64, ppc, s390, arm and sh,
227 and the last one for mips.
228 .\" parisc is a law unto itself
229 A \- denotes that a signal is absent on the corresponding architecture.)
230
231 First the signals described in the original POSIX.1-1990 standard.
232 .TS
233 l c c l
234 ____
235 lB c c l.
236 Signal  Value   Action  Comment
237 SIGHUP  \01     Term    Hangup detected on controlling terminal
238                         or death of controlling process
239 SIGINT  \02     Term    Interrupt from keyboard
240 SIGQUIT \03     Core    Quit from keyboard
241 SIGILL  \04     Core    Illegal Instruction
242 SIGABRT \06     Core    Abort signal from \fBabort\fP(3)
243 SIGFPE  \08     Core    Floating point exception
244 SIGKILL \09     Term    Kill signal
245 SIGSEGV 11      Core    Invalid memory reference
246 SIGPIPE 13      Term    Broken pipe: write to pipe with no
247                         readers
248 SIGALRM 14      Term    Timer signal from \fBalarm\fP(2)
249 SIGTERM 15      Term    Termination signal
250 SIGUSR1 30,10,16        Term    User-defined signal 1
251 SIGUSR2 31,12,17        Term    User-defined signal 2
252 SIGCHLD 20,17,18        Ign     Child stopped or terminated
253 SIGCONT 19,18,25        Cont    Continue if stopped
254 SIGSTOP 17,19,23        Stop    Stop process
255 SIGTSTP 18,20,24        Stop    Stop typed at tty
256 SIGTTIN 21,21,26        Stop    tty input for background process
257 SIGTTOU 22,22,27        Stop    tty output for background process
258 .TE
259
260 The signals
261 .B SIGKILL
262 and
263 .B SIGSTOP
264 cannot be caught, blocked, or ignored.
265
266 Next the signals not in the POSIX.1-1990 standard but described in
267 SUSv2 and POSIX.1-2001.
268 .TS
269 l c c l
270 ____
271 lB c c l.
272 Signal  Value   Action  Comment
273 SIGBUS  10,7,10 Core    Bus error (bad memory access)
274 SIGPOLL         Term    Pollable event (Sys V).
275                         Synonym for \fBSIGIO\fP
276 SIGPROF 27,27,29        Term    Profiling timer expired
277 SIGSYS  12,31,12        Core    Bad argument to routine (SVr4)
278 SIGTRAP 5       Core    Trace/breakpoint trap
279 SIGURG  16,23,21        Ign     Urgent condition on socket (4.2BSD)
280 SIGVTALRM       26,26,28        Term    Virtual alarm clock (4.2BSD)
281 SIGXCPU 24,24,30        Core    CPU time limit exceeded (4.2BSD)
282 SIGXFSZ 25,25,31        Core    File size limit exceeded (4.2BSD)
283 .TE
284
285 Up to and including Linux 2.2, the default behavior for
286 .BR SIGSYS ", " SIGXCPU ", " SIGXFSZ ", "
287 and (on architectures other than SPARC and MIPS)
288 .B SIGBUS
289 was to terminate the process (without a core dump).
290 (On some other UNIX systems the default action for
291 .BR SIGXCPU " and " SIGXFSZ
292 is to terminate the process without a core dump.)
293 Linux 2.4 conforms to the POSIX.1-2001 requirements for these signals,
294 terminating the process with a core dump.
295
296 Next various other signals.
297 .TS
298 l c c l
299 ____
300 lB c c l.
301 Signal  Value   Action  Comment
302 SIGIOT  6       Core    IOT trap. A synonym for \fBSIGABRT\fP
303 SIGEMT  7,\-,7  Term
304 SIGSTKFLT       \-,16,\-        Term    Stack fault on coprocessor (unused)
305 SIGIO   23,29,22        Term    I/O now possible (4.2BSD)
306 SIGCLD  \-,\-,18        Ign     A synonym for \fBSIGCHLD\fP
307 SIGPWR  29,30,19        Term    Power failure (System V)
308 SIGINFO 29,\-,\-                A synonym for \fBSIGPWR\fP
309 SIGLOST \-,\-,\-        Term    File lock lost
310 SIGWINCH        28,28,20        Ign     Window resize signal (4.3BSD, Sun)
311 SIGUNUSED       \-,31,\-        Core    Synonymous with \fBSIGSYS\fP
312 .TE
313
314 (Signal 29 is
315 .B SIGINFO
316 /
317 .B SIGPWR
318 on an alpha but
319 .B SIGLOST
320 on a sparc.)
321
322 .B SIGEMT
323 is not specified in POSIX.1-2001, but nevertheless appears
324 on most other UNIX systems,
325 where its default action is typically to terminate
326 the process with a core dump.
327
328 .B SIGPWR
329 (which is not specified in POSIX.1-2001) is typically ignored
330 by default on those other UNIX systems where it appears.
331
332 .B SIGIO
333 (which is not specified in POSIX.1-2001) is ignored by default
334 on several other UNIX systems.
335
336 Where defined,
337 .B SIGUNUSED
338 is synonymous with
339 .\" parisc is the only exception: SIGSYS is 12, SIGUNUSED is 31
340 .B SIGSYS
341 on most architectures.
342 .SS "Real-time Signals"
343 Linux supports real-time signals as originally defined in the POSIX.1b
344 real-time extensions (and now included in POSIX.1-2001).
345 The range of supported real-time signals is defined by the macros
346 .B SIGRTMIN
347 and
348 .BR SIGRTMAX .
349 POSIX.1-2001 requires that an implementation support at least
350 .B _POSIX_RTSIG_MAX
351 (8) real-time signals.
352 .PP
353 The Linux kernel supports a range of 32 different real-time
354 signals, numbered 33 to 64.
355 However, the glibc POSIX threads implementation internally uses
356 two (for NPTL) or three (for LinuxThreads) real-time signals
357 (see
358 .BR pthreads (7)),
359 and adjusts the value of
360 .B SIGRTMIN
361 suitably (to 34 or 35).
362 Because the range of available real-time signals varies according
363 to the glibc threading implementation (and this variation can occur
364 at run time according to the available kernel and glibc),
365 and indeed the range of real-time signals varies across UNIX systems,
366 programs should
367 .IR "never refer to real-time signals using hard-coded numbers" ,
368 but instead should always refer to real-time signals using the notation
369 .BR SIGRTMIN +n,
370 and include suitable (run-time) checks that
371 .BR SIGRTMIN +n
372 does not exceed
373 .BR SIGRTMAX .
374 .PP
375 Unlike standard signals, real-time signals have no predefined meanings:
376 the entire set of real-time signals can be used for application-defined
377 purposes.
378 .PP
379 The default action for an unhandled real-time signal is to terminate the
380 receiving process.
381 .PP
382 Real-time signals are distinguished by the following:
383 .IP 1. 4
384 Multiple instances of real-time signals can be queued.
385 By contrast, if multiple instances of a standard signal are delivered
386 while that signal is currently blocked, then only one instance is queued.
387 .IP 2. 4
388 If the signal is sent using
389 .BR sigqueue (3),
390 an accompanying value (either an integer or a pointer) can be sent
391 with the signal.
392 If the receiving process establishes a handler for this signal using the
393 .B SA_SIGINFO
394 flag to
395 .BR sigaction (2)
396 then it can obtain this data via the
397 .I si_value
398 field of the
399 .I siginfo_t
400 structure passed as the second argument to the handler.
401 Furthermore, the
402 .I si_pid
403 and
404 .I si_uid
405 fields of this structure can be used to obtain the PID
406 and real user ID of the process sending the signal.
407 .IP 3. 4
408 Real-time signals are delivered in a guaranteed order.
409 Multiple real-time signals of the same type are delivered in the order
410 they were sent.
411 If different real-time signals are sent to a process, they are delivered
412 starting with the lowest-numbered signal.
413 (I.e., low-numbered signals have highest priority.)
414 By contrast, if multiple standard signals are pending for a process,
415 the order in which they are delivered is unspecified.
416 .PP
417 If both standard and real-time signals are pending for a process,
418 POSIX leaves it unspecified which is delivered first.
419 Linux, like many other implementations, gives priority
420 to standard signals in this case.
421 .PP
422 According to POSIX, an implementation should permit at least
423 .B _POSIX_SIGQUEUE_MAX
424 (32) real-time signals to be queued to
425 a process.
426 However, Linux does things differently.
427 In kernels up to and including 2.6.7, Linux imposes
428 a system-wide limit on the number of queued real-time signals
429 for all processes.
430 This limit can be viewed and (with privilege) changed via the
431 .I /proc/sys/kernel/rtsig-max
432 file.
433 A related file,
434 .IR /proc/sys/kernel/rtsig-nr ,
435 can be used to find out how many real-time signals are currently queued.
436 In Linux 2.6.8, these
437 .I /proc
438 interfaces were replaced by the
439 .B RLIMIT_SIGPENDING
440 resource limit, which specifies a per-user limit for queued
441 signals; see
442 .BR setrlimit (2)
443 for further details.
444 .SS "Async-signal-safe functions"
445 .PP
446 A signal handler function must be very careful,
447 since processing elsewhere may be interrupted
448 at some arbitrary point in the execution of the program.
449 POSIX has the concept of "safe function".
450 If a signal interrupts the execution of an unsafe function, and
451 .I handler
452 calls an unsafe function, then the behavior of the program is undefined.
453
454 POSIX.1-2004 (also known as POSIX.1-2001 Technical Corrigendum 2)
455 requires an implementation to guarantee that the following
456 functions can be safely called inside a signal handler:
457
458 .in +4
459 .nf
460 _Exit()
461 _exit()
462 abort()
463 accept()
464 access()
465 aio_error()
466 aio_return()
467 aio_suspend()
468 alarm()
469 bind()
470 cfgetispeed()
471 cfgetospeed()
472 cfsetispeed()
473 cfsetospeed()
474 chdir()
475 chmod()
476 chown()
477 clock_gettime()
478 close()
479 connect()
480 creat()
481 dup()
482 dup2()
483 execle()
484 execve()
485 fchmod()
486 fchown()
487 fcntl()
488 fdatasync()
489 fork()
490 fpathconf()
491 fstat()
492 fsync()
493 ftruncate()
494 getegid()
495 geteuid()
496 getgid()
497 getgroups()
498 getpeername()
499 getpgrp()
500 getpid()
501 getppid()
502 getsockname()
503 getsockopt()
504 getuid()
505 kill()
506 link()
507 listen()
508 lseek()
509 lstat()
510 mkdir()
511 mkfifo()
512 open()
513 pathconf()
514 pause()
515 pipe()
516 poll()
517 posix_trace_event()
518 pselect()
519 raise()
520 read()
521 readlink()
522 recv()
523 recvfrom()
524 recvmsg()
525 rename()
526 rmdir()
527 select()
528 sem_post()
529 send()
530 sendmsg()
531 sendto()
532 setgid()
533 setpgid()
534 setsid()
535 setsockopt()
536 setuid()
537 shutdown()
538 sigaction()
539 sigaddset()
540 sigdelset()
541 sigemptyset()
542 sigfillset()
543 sigismember()
544 signal()
545 sigpause()
546 sigpending()
547 sigprocmask()
548 sigqueue()
549 sigset()
550 sigsuspend()
551 sleep()
552 sockatmark()
553 socket()
554 socketpair()
555 stat()
556 symlink()
557 sysconf()
558 tcdrain()
559 tcflow()
560 tcflush()
561 tcgetattr()
562 tcgetpgrp()
563 tcsendbreak()
564 tcsetattr()
565 tcsetpgrp()
566 time()
567 timer_getoverrun()
568 timer_gettime()
569 timer_settime()
570 times()
571 umask()
572 uname()
573 unlink()
574 utime()
575 wait()
576 waitpid()
577 write()
578 .fi
579 .in
580 .PP
581 POSIX.1-2008 removes fpathconf(), pathconf(), and sysconf()
582 from the above list, and adds the following functions:
583 .PP
584 .in +4n
585 .nf
586 execl()
587 execv()
588 faccessat()
589 fchmodat()
590 fchownat()
591 fexecve()
592 fstatat()
593 futimens()
594 linkat()
595 mkdirat()
596 mkfifoat()
597 mknod()
598 mknodat()
599 openat()
600 readlinkat()
601 renameat()
602 symlinkat()
603 unlinkat()
604 utimensat()
605 utimes()
606 .fi
607 .in
608 .SS Interruption of System Calls and Library Functions by Signal Handlers
609 If a signal handler is invoked while a system call or library
610 function call is blocked, then either:
611 .IP * 2
612 the call is automatically restarted after the signal handler returns; or
613 .IP *
614 the call fails with the error
615 .BR EINTR .
616 .PP
617 Which of these two behaviors occurs depends on the interface and
618 whether or not the signal handler was established using the
619 .BR SA_RESTART
620 flag (see
621 .BR sigaction (2)).
622 The details vary across UNIX systems;
623 below, the details for Linux.
624
625 If a blocked call to one of the following interfaces is interrupted
626 by a signal handler, then the call will be automatically restarted
627 after the signal handler returns if the
628 .BR SA_RESTART
629 flag was used; otherwise the call will fail with the error
630 .BR EINTR :
631 .\" The following system calls use ERESTARTSYS,
632 .\" so that they are restartable
633 .RS 4
634 .IP * 2
635 .BR read (2),
636 .BR readv (2),
637 .BR write (2),
638 .BR writev (2),
639 and
640 .BR ioctl (2)
641 calls on "slow" devices.
642 A "slow" device is one where the I/O call may block for an
643 indefinite time, for example, a terminal, pipe, or socket.
644 (A disk is not a slow device according to this definition.)
645 If an I/O call on a slow device has already transferred some
646 data by the time it is interrupted by a signal handler,
647 then the call will return a success status
648 (normally, the number of bytes transferred).
649 .IP *
650 .BR open (2),
651 if it can block (e.g., when opening a FIFO; see
652 .BR fifo (7)).
653 .IP *
654 .BR wait (2),
655 .BR wait3 (2),
656 .BR wait4 (2),
657 .BR waitid (2),
658 and
659 .BR waitpid (2).
660 .IP *
661 Socket interfaces:
662 .\" If a timeout (setsockopt()) is in effect on the socket, then these
663 .\" system calls switch to using EINTR.  Consequently, they and are not
664 .\" automatically restarted, and they show the stop/cont behavior
665 .\" described below.  (Verified from 2.6.26 source, and by experiment; mtk)
666 .BR accept (2),
667 .BR connect (2),
668 .BR recv (2),
669 .BR recvfrom (2),
670 .BR recvmsg (2),
671 .BR send (2),
672 .BR sendto (2),
673 and
674 .BR sendmsg (2),
675 unless a timeout has been set on the socket (see below).
676 .IP *
677 File locking interfaces:
678 .BR flock (2)
679 and
680 .BR fcntl (2)
681 .BR F_SETLKW .
682 .IP *
683 POSIX message queue interfaces:
684 .BR mq_receive (3),
685 .BR mq_timedreceive (3),
686 .BR mq_send (3),
687 and
688 .BR mq_timedsend (3).
689 .IP *
690 .BR futex (2)
691 .B FUTEX_WAIT
692 (since Linux 2.6.22; beforehand, always failed with
693 .BR EINTR ).
694 .IP *
695 POSIX semaphore interfaces:
696 .BR sem_wait (3)
697 and
698 .BR sem_timedwait (3)
699 (since Linux 2.6.22; beforehand, always failed with
700 .BR EINTR ).
701 .RE
702 .PP
703 The following interfaces are never restarted after
704 being interrupted by a signal handler,
705 regardless of the use of
706 .BR SA_RESTART ;
707 they always fail with the error
708 .B EINTR
709 when interrupted by a signal handler:
710 .\" These are the system calls that give EINTR or ERESTARTNOHAND
711 .\" on interruption by a signal handler.
712 .RS 4
713 .IP * 2
714 Socket interfaces, when a timeout has been set on the socket using
715 .BR setsockopt (2):
716 .BR accept (2),
717 .BR recv (2),
718 .BR recvfrom (2),
719 and
720 .BR recvmsg (2),
721 if a receive timeout
722 .RB ( SO_RCVTIMEO )
723 has been set;
724 .BR connect (2),
725 .BR send (2),
726 .BR sendto (2),
727 and
728 .BR sendmsg (2),
729 if a send timeout
730 .RB ( SO_SNDTIMEO )
731 has been set.
732 .IP *
733 Interfaces used to wait for signals:
734 .BR pause (2),
735 .BR sigsuspend (2),
736 .BR sigtimedwait (2),
737 and
738 .BR sigwaitinfo (2).
739 .IP *
740 File descriptor multiplexing interfaces:
741 .BR epoll_wait (2),
742 .BR epoll_pwait (2),
743 .BR poll (2),
744 .BR ppoll (2),
745 .BR select (2),
746 and
747 .BR pselect (2).
748 .IP *
749 System V IPC interfaces:
750 .\" On some other systems, SA_RESTART does restart these system calls
751 .BR msgrcv (2),
752 .BR msgsnd (2),
753 .BR semop (2),
754 and
755 .BR semtimedop (2).
756 .IP *
757 Sleep interfaces:
758 .BR clock_nanosleep (2),
759 .BR nanosleep (2),
760 and
761 .BR usleep (3).
762 .IP *
763 .BR read (2)
764 from an
765 .BR inotify (7)
766 file descriptor.
767 .IP *
768 .BR io_getevents (2).
769 .RE
770 .PP
771 The
772 .BR sleep (3)
773 function is also never restarted if interrupted by a handler,
774 but gives a success return: the number of seconds remaining to sleep.
775 .SS Interruption of System Calls and Library Functions by Stop Signals
776 On Linux, even in the absence of signal handlers,
777 certain blocking interfaces can fail with the error
778 .BR EINTR
779 after the process is stopped by one of the stop signals
780 and then resumed via
781 .BR SIGCONT .
782 This behavior is not sanctioned by POSIX.1, and doesn't occur
783 on other systems.
784
785 The Linux interfaces that display this behavior are:
786 .RS 4
787 .IP * 2
788 Socket interfaces, when a timeout has been set on the socket using
789 .BR setsockopt (2):
790 .BR accept (2),
791 .BR recv (2),
792 .BR recvfrom (2),
793 and
794 .BR recvmsg (2),
795 if a receive timeout
796 .RB ( SO_RCVTIMEO )
797 has been set;
798 .BR connect (2),
799 .BR send (2),
800 .BR sendto (2),
801 and
802 .BR sendmsg (2),
803 if a send timeout
804 .RB ( SO_SNDTIMEO )
805 has been set.
806 .IP * 2
807 .BR epoll_wait (2),
808 .BR epoll_pwait (2).
809 .IP *
810 .BR semop (2),
811 .BR semtimedop (2).
812 .IP *
813 .BR sigtimedwait (2),
814 .BR sigwaitinfo (2).
815 .IP *
816 .BR read (2)
817 from an
818 .BR inotify (7)
819 file descriptor.
820 .IP *
821 Linux 2.6.21 and earlier:
822 .BR futex (2)
823 .BR FUTEX_WAIT ,
824 .BR sem_timedwait (3),
825 .BR sem_wait (3).
826 .IP *
827 Linux 2.6.8 and earlier:
828 .BR msgrcv (2),
829 .BR msgsnd (2).
830 .IP *
831 Linux 2.4 and earlier:
832 .BR nanosleep (2).
833 .RE
834 .SH "CONFORMING TO"
835 POSIX.1, except as noted.
836 .SH BUGS
837 .B SIGIO
838 and
839 .B SIGLOST
840 have the same value.
841 The latter is commented out in the kernel source, but
842 the build process of some software still thinks that
843 signal 29 is
844 .BR SIGLOST .
845 .SH "SEE ALSO"
846 .BR kill (1),
847 .BR getrlimit (2),
848 .BR kill (2),
849 .BR killpg (2),
850 .BR rt_sigqueueinfo (2),
851 .BR setitimer (2),
852 .BR setrlimit (2),
853 .BR sgetmask (2),
854 .BR sigaction (2),
855 .BR sigaltstack (2),
856 .BR signal (2),
857 .BR signalfd (2),
858 .BR sigpending (2),
859 .BR sigprocmask (2),
860 .BR sigsuspend (2),
861 .BR sigwaitinfo (2),
862 .BR abort (3),
863 .BR bsd_signal (3),
864 .BR longjmp (3),
865 .BR raise (3),
866 .BR pthread_sigqueue (3),
867 .BR sigqueue (3),
868 .BR sigset (3),
869 .BR sigsetops (3),
870 .BR sigvec (3),
871 .BR sigwait (3),
872 .BR strsignal (3),
873 .BR sysv_signal (3),
874 .BR core (5),
875 .BR proc (5),
876 .BR pthreads (7),
877 .BR sigevent (7)