share/mk/: build-html: Don't build mbind.2 and set_mempolicy.2
[man-pages.git] / man3 / bsd_signal.3
blob00026fee573af48e6e10c918f29072ce8ec8af0b
1 '\" t
2 .\" Copyright (c) 2007 Michael Kerrisk <mtk.manpages@gmail.com>
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .TH bsd_signal 3 (date) "Linux man-pages (unreleased)"
7 .SH NAME
8 bsd_signal \- signal handling with BSD semantics
9 .SH LIBRARY
10 Standard C library
11 .RI ( libc ", " \-lc )
12 .SH SYNOPSIS
13 .nf
14 .B #include <signal.h>
16 .B typedef void (*sighandler_t)(int);
18 .BI "sighandler_t bsd_signal(int " signum ", sighandler_t " handler );
19 .fi
21 .RS -4
22 Feature Test Macro Requirements for glibc (see
23 .BR feature_test_macros (7)):
24 .RE
26 .BR bsd_signal ():
27 .nf
28     Since glibc 2.26:
29         _XOPEN_SOURCE >= 500
30 .\"    || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
31             && ! (_POSIX_C_SOURCE >= 200809L)
32     glibc 2.25 and earlier:
33         _XOPEN_SOURCE
34 .fi
35 .SH DESCRIPTION
36 The
37 .BR bsd_signal ()
38 function takes the same arguments, and performs the same task, as
39 .BR signal (2).
41 The difference between the two is that
42 .BR bsd_signal ()
43 is guaranteed to provide reliable signal semantics, that is:
44 a) the disposition of the signal is not reset to the default
45 when the handler is invoked;
46 b) delivery of further instances of the signal is blocked while
47 the signal handler is executing; and
48 c) if the handler interrupts a blocking system call,
49 then the system call is automatically restarted.
50 A portable application cannot rely on
51 .BR signal (2)
52 to provide these guarantees.
53 .SH RETURN VALUE
54 The
55 .BR bsd_signal ()
56 function returns the previous value of the signal handler, or
57 .B SIG_ERR
58 on error.
59 .SH ERRORS
60 As for
61 .BR signal (2).
62 .SH ATTRIBUTES
63 For an explanation of the terms used in this section, see
64 .BR attributes (7).
65 .TS
66 allbox;
67 lbx lb lb
68 l l l.
69 Interface       Attribute       Value
71 .na
72 .nh
73 .BR bsd_signal ()
74 T}      Thread safety   MT-Safe
75 .TE
76 .SH VERSIONS
77 Use of
78 .BR bsd_signal ()
79 should be avoided; use
80 .BR sigaction (2)
81 instead.
83 On modern Linux systems,
84 .BR bsd_signal ()
85 and
86 .BR signal (2)
87 are equivalent.
88 But on older systems,
89 .BR signal (2)
90 provided unreliable signal semantics; see
91 .BR signal (2)
92 for details.
94 The use of
95 .I sighandler_t
96 is a GNU extension;
97 this type is defined only if the
98 .B _GNU_SOURCE
99 feature test macro is defined.
100 .SH STANDARDS
101 None.
102 .SH HISTORY
103 4.2BSD, POSIX.1-2001.
104 Removed in POSIX.1-2008,
105 recommending the use of
106 .BR sigaction (2)
107 instead.
108 .SH SEE ALSO
109 .BR sigaction (2),
110 .BR signal (2),
111 .BR sysv_signal (3),
112 .BR signal (7)