]>
Commit | Line | Data |
---|---|---|
c11b1abf | 1 | .\" Copyright (c) 2007 Michael Kerrisk <mtk.manpages@gmail.com> |
2e8d048a | 2 | .\" |
93015253 | 3 | .\" %%%LICENSE_START(VERBATIM) |
2e8d048a MK |
4 | .\" Permission is granted to make and distribute verbatim copies of this |
5 | .\" manual provided the copyright notice and this permission notice are | |
6 | .\" preserved on all copies. | |
7 | .\" | |
8 | .\" Permission is granted to copy and distribute modified versions of this | |
9 | .\" manual under the conditions for verbatim copying, provided that the | |
10 | .\" entire resulting derived work is distributed under the terms of a | |
11 | .\" permission notice identical to this one. | |
12 | .\" | |
13 | .\" Since the Linux kernel and libraries are constantly changing, this | |
14 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
15 | .\" responsibility for errors or omissions, or for damages resulting from | |
16 | .\" the use of the information contained herein. The author(s) may not | |
17 | .\" have taken the same level of care in the production of this manual, | |
18 | .\" which is licensed free of charge, as they might when working | |
19 | .\" professionally. | |
20 | .\" | |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by | |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 23 | .\" %%%LICENSE_END |
2e8d048a | 24 | .\" |
4b8c67d9 | 25 | .TH BSD_SIGNAL 3 2017-09-15 "" "Linux Programmer's Manual" |
2e8d048a MK |
26 | .SH NAME |
27 | bsd_signal \- signal handling with BSD semantics | |
28 | .SH SYNOPSIS | |
2e8d048a | 29 | .B #include <signal.h> |
68e4db0a | 30 | .PP |
2e8d048a | 31 | .B typedef void (*sighandler_t)(int); |
68e4db0a | 32 | .PP |
2e8d048a | 33 | .BI "sighandler_t bsd_signal(int " signum ", sighandler_t " handler ); |
68e4db0a | 34 | .PP |
940758ab MK |
35 | .in -4n |
36 | Feature Test Macro Requirements for glibc (see | |
37 | .BR feature_test_macros (7)): | |
38 | .in | |
68e4db0a | 39 | .PP |
940758ab MK |
40 | .ad l |
41 | .BR bsd_signal (): | |
42 | .RS 4 | |
43 | Since glibc 2.26: | |
44 | _XOPEN_SOURCE >= 500 | |
45 | .\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED | |
8eb09b12 | 46 | && ! (_POSIX_C_SOURCE\ >=\ 200809L) |
940758ab MK |
47 | .br |
48 | Glibc 2.25 and earlier: | |
49 | _XOPEN_SOURCE | |
50 | .RE | |
51 | .ad b | |
2e8d048a MK |
52 | .SH DESCRIPTION |
53 | The | |
54 | .BR bsd_signal () | |
55 | function takes the same arguments, and performs the same task, as | |
56 | .BR signal (2). | |
847e0d88 | 57 | .PP |
2e8d048a MK |
58 | The difference between the two is that |
59 | .BR bsd_signal () | |
60 | is guaranteed to provide reliable signal semantics, that is: | |
61 | a) the disposition of the signal is not reset to the default | |
62 | when the handler is invoked; | |
63 | b) delivery of further instances of the signal is blocked while | |
64 | the signal handler is executing; and | |
65 | c) if the handler interrupts a blocking system call, | |
66 | then the system call is automatically restarted. | |
67 | A portable application cannot rely on | |
68 | .BR signal (2) | |
69 | to provide these guarantees. | |
47297adb | 70 | .SH RETURN VALUE |
2e8d048a MK |
71 | The |
72 | .BR bsd_signal () | |
73 | function returns the previous value of the signal handler, or | |
74 | .B SIG_ERR | |
75 | on error. | |
76 | .SH ERRORS | |
77 | As for | |
78 | .BR signal (2). | |
1d4be868 | 79 | .SH ATTRIBUTES |
e5ea1160 MK |
80 | For an explanation of the terms used in this section, see |
81 | .BR attributes (7). | |
82 | .TS | |
83 | allbox; | |
84 | lb lb lb | |
85 | l l l. | |
86 | Interface Attribute Value | |
87 | T{ | |
1d4be868 | 88 | .BR bsd_signal () |
e5ea1160 MK |
89 | T} Thread safety MT-Safe |
90 | .TE | |
47297adb | 91 | .SH CONFORMING TO |
2b2581ee | 92 | 4.2BSD, POSIX.1-2001. |
44a31ea5 | 93 | POSIX.1-2008 removes the specification of |
67bb8742 MK |
94 | .BR bsd_signal (), |
95 | recommending the use of | |
96 | .BR sigaction (2) | |
97 | instead. | |
2e8d048a MK |
98 | .SH NOTES |
99 | Use of | |
100 | .BR bsd_signal () | |
101 | should be avoided; use | |
102 | .BR sigaction (2) | |
103 | instead. | |
847e0d88 | 104 | .PP |
2e8d048a MK |
105 | On modern Linux systems, |
106 | .BR bsd_signal () | |
107 | and | |
108 | .BR signal (2) | |
109 | are equivalent. | |
988db661 | 110 | But on older systems, |
2e8d048a MK |
111 | .BR signal (2) |
112 | provided unreliable signal semantics; see | |
113 | .BR signal (2) | |
114 | for details. | |
847e0d88 | 115 | .PP |
2e8d048a | 116 | The use of |
66ee0c7e | 117 | .I sighandler_t |
2e8d048a | 118 | is a GNU extension; |
33a0ccb2 | 119 | this type is defined only if the |
c3dfd2c8 MK |
120 | .B _GNU_SOURCE |
121 | feature test macro is defined. | |
47297adb | 122 | .SH SEE ALSO |
2e8d048a MK |
123 | .BR sigaction (2), |
124 | .BR signal (2), | |
125 | .BR sysv_signal (3), | |
2e8d048a | 126 | .BR signal (7) |