]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/bsd_signal.3
getauxval.3: wfix
[thirdparty/man-pages.git] / man3 / bsd_signal.3
1 .\" Copyright (c) 2007 Michael Kerrisk <mtk.manpages@gmail.com>
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
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.
23 .\" %%%LICENSE_END
24 .\"
25 .TH BSD_SIGNAL 3 2015-03-02 "" "Linux Programmer's Manual"
26 .SH NAME
27 bsd_signal \- signal handling with BSD semantics
28 .SH SYNOPSIS
29 .BR "#define _XOPEN_SOURCE" " /* See feature_test_macros(7) */"
30 .br
31 .B #include <signal.h>
32 .sp
33 .B typedef void (*sighandler_t)(int);
34 .sp
35 .BI "sighandler_t bsd_signal(int " signum ", sighandler_t " handler );
36 .SH DESCRIPTION
37 The
38 .BR bsd_signal ()
39 function takes the same arguments, and performs the same task, as
40 .BR signal (2).
41
42 The difference between the two is that
43 .BR bsd_signal ()
44 is guaranteed to provide reliable signal semantics, that is:
45 a) the disposition of the signal is not reset to the default
46 when the handler is invoked;
47 b) delivery of further instances of the signal is blocked while
48 the signal handler is executing; and
49 c) if the handler interrupts a blocking system call,
50 then the system call is automatically restarted.
51 A portable application cannot rely on
52 .BR signal (2)
53 to provide these guarantees.
54 .SH RETURN VALUE
55 The
56 .BR bsd_signal ()
57 function returns the previous value of the signal handler, or
58 .B SIG_ERR
59 on error.
60 .SH ERRORS
61 As for
62 .BR signal (2).
63 .SH ATTRIBUTES
64 For an explanation of the terms used in this section, see
65 .BR attributes (7).
66 .TS
67 allbox;
68 lb lb lb
69 l l l.
70 Interface Attribute Value
71 T{
72 .BR bsd_signal ()
73 T} Thread safety MT-Safe
74 .TE
75 .SH CONFORMING TO
76 4.2BSD, POSIX.1-2001.
77 POSIX.1-2008 removes the specification of
78 .BR bsd_signal (),
79 recommending the use of
80 .BR sigaction (2)
81 instead.
82 .SH NOTES
83 Use of
84 .BR bsd_signal ()
85 should be avoided; use
86 .BR sigaction (2)
87 instead.
88
89 On modern Linux systems,
90 .BR bsd_signal ()
91 and
92 .BR signal (2)
93 are equivalent.
94 But on older systems,
95 .BR signal (2)
96 provided unreliable signal semantics; see
97 .BR signal (2)
98 for details.
99
100 The use of
101 .I sighandler_t
102 is a GNU extension;
103 this type is defined only if the
104 .B _GNU_SOURCE
105 feature test macro is defined.
106 .SH SEE ALSO
107 .BR sigaction (2),
108 .BR signal (2),
109 .BR sysv_signal (3),
110 .BR signal (7)