OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[linuxjm/LDP_man-pages.git] / original / man3 / bsd_signal.3
1 .\" Copyright (c) 2007 Michael Kerrisk <mtk.manpages@gmail.com>
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .TH BSD_SIGNAL 3 2009-03-15 "" "Linux Programmer's Manual"
24 .SH NAME
25 bsd_signal \- signal handling with BSD semantics
26 .SH SYNOPSIS
27 .B #define _XOPEN_SOURCE
28 .br
29 .B #include <signal.h>
30 .sp
31 .B typedef void (*sighandler_t)(int);
32 .sp
33 .BI "sighandler_t bsd_signal(int " signum ", sighandler_t " handler );
34 .SH DESCRIPTION
35 The
36 .BR bsd_signal ()
37 function takes the same arguments, and performs the same task, as
38 .BR signal (2).
39
40 The difference between the two is that
41 .BR bsd_signal ()
42 is guaranteed to provide reliable signal semantics, that is:
43 a) the disposition of the signal is not reset to the default
44 when the handler is invoked;
45 b) delivery of further instances of the signal is blocked while
46 the signal handler is executing; and
47 c) if the handler interrupts a blocking system call,
48 then the system call is automatically restarted.
49 A portable application cannot rely on
50 .BR signal (2)
51 to provide these guarantees.
52 .SH "RETURN VALUE"
53 The
54 .BR bsd_signal ()
55 function returns the previous value of the signal handler, or
56 .B SIG_ERR
57 on error.
58 .SH ERRORS
59 As for
60 .BR signal (2).
61 .SH "CONFORMING TO"
62 4.2BSD, POSIX.1-2001.
63 POSIX.1-2008 removes the specification of
64 .BR bsd_signal (),
65 recommending the use of
66 .BR sigaction (2)
67 instead.
68 .SH NOTES
69 Use of
70 .BR bsd_signal ()
71 should be avoided; use
72 .BR sigaction (2)
73 instead.
74
75 On modern Linux systems,
76 .BR bsd_signal ()
77 and
78 .BR signal (2)
79 are equivalent.
80 But on older systems,
81 .BR signal (2)
82 provided unreliable signal semantics; see
83 .BR signal (2)
84 for details.
85
86 The use of
87 .I sighandler_t
88 is a GNU extension;
89 this type is only defined if the
90 .B _GNU_SOURCE
91 feature test macro is defined.
92 .SH "SEE ALSO"
93 .BR sigaction (2),
94 .BR signal (2),
95 .BR sysv_signal (3),
96 .BR feature_test_macros (7),
97 .BR signal (7)