1bsd_signal(3)              Library Functions Manual              bsd_signal(3)
2
3
4

NAME

6       bsd_signal - signal handling with BSD semantics
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

12       #include <signal.h>
13
14       typedef void (*sighandler_t)(int);
15
16       sighandler_t bsd_signal(int signum, sighandler_t handler);
17
18   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
19
20       bsd_signal():
21           Since glibc 2.26:
22               _XOPEN_SOURCE >= 500
23                   && ! (_POSIX_C_SOURCE >= 200809L)
24           glibc 2.25 and earlier:
25               _XOPEN_SOURCE
26

DESCRIPTION

28       The  bsd_signal()  function  takes the same arguments, and performs the
29       same task, as signal(2).
30
31       The difference between the two is that bsd_signal()  is  guaranteed  to
32       provide  reliable  signal semantics, that is: a) the disposition of the
33       signal is not reset to the default when the handler is invoked; b)  de‐
34       livery  of  further instances of the signal is blocked while the signal
35       handler is executing; and c) if the handler interrupts a blocking  sys‐
36       tem  call, then the system call is automatically restarted.  A portable
37       application cannot rely on signal(2) to provide these guarantees.
38

RETURN VALUE

40       The bsd_signal() function returns the previous value of the signal han‐
41       dler, or SIG_ERR on error.
42

ERRORS

44       As for signal(2).
45

ATTRIBUTES

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

VERSIONS

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

STANDARDS

67       None.
68

HISTORY

70       4.2BSD, POSIX.1-2001.  Removed in POSIX.1-2008, recommending the use of
71       sigaction(2) instead.
72

SEE ALSO

74       sigaction(2), signal(2), sysv_signal(3), signal(7)
75
76
77
78Linux man-pages 6.05              2023-07-20                     bsd_signal(3)
Impressum