1BSD_SIGNAL(3)              Linux Programmer's Manual             BSD_SIGNAL(3)
2
3
4

NAME

6       bsd_signal - signal handling with BSD semantics
7

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

37       The bsd_signal() function returns the previous value of the signal han‐
38       dler, or SIG_ERR on error.
39

ERRORS

41       As for signal(2).
42

ATTRIBUTES

44       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
45       tributes(7).
46
47       ┌────────────────────────────────────────────┬───────────────┬─────────┐
48Interface                                   Attribute     Value   
49       ├────────────────────────────────────────────┼───────────────┼─────────┤
50bsd_signal()                                │ Thread safety │ MT-Safe │
51       └────────────────────────────────────────────┴───────────────┴─────────┘
52

CONFORMING TO

54       4.2BSD,  POSIX.1-2001.   POSIX.1-2008  removes  the  specification   of
55       bsd_signal(), recommending the use of sigaction(2) instead.
56

NOTES

58       Use of bsd_signal() should be avoided; use sigaction(2) instead.
59
60       On  modern  Linux  systems,  bsd_signal() and signal(2) are equivalent.
61       But on older systems, signal(2) provided unreliable  signal  semantics;
62       see signal(2) for details.
63
64       The  use  of sighandler_t is a GNU extension; this type is defined only
65       if the _GNU_SOURCE feature test macro is defined.
66

SEE ALSO

68       sigaction(2), signal(2), sysv_signal(3), signal(7)
69

COLOPHON

71       This page is part of release 5.13 of the Linux  man-pages  project.   A
72       description  of  the project, information about reporting bugs, and the
73       latest    version    of    this    page,    can     be     found     at
74       https://www.kernel.org/doc/man-pages/.
75
76
77
78                                  2021-03-22                     BSD_SIGNAL(3)
Impressum