1BSD_SIGNAL(3) Linux Programmer's Manual BSD_SIGNAL(3)
2
3
4
6 bsd_signal - signal handling with BSD semantics
7
9 #include <signal.h>
10
11 typedef void (*sighandler_t)(int);
12
13 sighandler_t bsd_signal(int signum, sighandler_t handler);
14
15 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
16
17 bsd_signal():
18 Since glibc 2.26:
19 _XOPEN_SOURCE >= 500
20 && ! (_POSIX_C_SOURCE >= 200809L)
21 Glibc 2.25 and earlier:
22 _XOPEN_SOURCE
23
25 The bsd_signal() function takes the same arguments, and performs the
26 same task, as signal(2).
27
28 The difference between the two is that bsd_signal() is guaranteed to
29 provide reliable signal semantics, that is: a) the disposition of the
30 signal is not reset to the default when the handler is invoked; b) de‐
31 livery of further instances of the signal is blocked while the signal
32 handler is executing; and c) if the handler interrupts a blocking sys‐
33 tem call, then the system call is automatically restarted. A portable
34 application cannot rely on signal(2) to provide these guarantees.
35
37 The bsd_signal() function returns the previous value of the signal han‐
38 dler, or SIG_ERR on error.
39
41 As for signal(2).
42
44 For an explanation of the terms used in this section, see at‐
45 tributes(7).
46
47 ┌─────────────┬───────────────┬─────────┐
48 │Interface │ Attribute │ Value │
49 ├─────────────┼───────────────┼─────────┤
50 │bsd_signal() │ Thread safety │ MT-Safe │
51 └─────────────┴───────────────┴─────────┘
53 4.2BSD, POSIX.1-2001. POSIX.1-2008 removes the specification of
54 bsd_signal(), recommending the use of sigaction(2) instead.
55
57 Use of bsd_signal() should be avoided; use sigaction(2) instead.
58
59 On modern Linux systems, bsd_signal() and signal(2) are equivalent.
60 But on older systems, signal(2) provided unreliable signal semantics;
61 see signal(2) for details.
62
63 The use of sighandler_t is a GNU extension; this type is defined only
64 if the _GNU_SOURCE feature test macro is defined.
65
67 sigaction(2), signal(2), sysv_signal(3), signal(7)
68
70 This page is part of release 5.10 of the Linux man-pages project. A
71 description of the project, information about reporting bugs, and the
72 latest version of this page, can be found at
73 https://www.kernel.org/doc/man-pages/.
74
75
76
77 2019-03-06 BSD_SIGNAL(3)