1bsd_signal(3C) Standard C Library Functions bsd_signal(3C)
2
3
4
6 bsd_signal - simplified signal facilities
7
9 #include <signal.h>
10
11 void (*bsd_signal(int sig, void (*func)(int)))(int);
12
13
15 The bsd_signal() function provides a partially compatible interface for
16 programs written to historical system interfaces (see USAGE below).
17
18
19 The function call bsd_signal(sig, func) has an effect as if implemented
20 as:
21
22 void (*bsd_signal(int sig, void (*func)(int)))(int)
23 {
24 struct sigaction act, oact;
25
26 act.sa_handler = func;
27 act.sa_flags = SA_RESTART;
28 sigemptyset(&act.sa_mask);
29 sigaddset(&act.sa_mask, sig);
30 if (sigaction(sig, &act, &oact) == −1)
31 return(SIG_ERR);
32 return(oact.sa_handler);
33 }
34
35
36
37 The handler function should be declared:
38
39 void handler(int sig);
40
41
42
43 where sig is the signal number. The behavior is undefined if func is a
44 function that takes more than one argument, or an argument of a differ‐
45 ent type.
46
48 Upon successful completion, bsd_signal() returns the previous action
49 for sig. Otherwise, SIG_ERR is returned and errno is set to indicate
50 the error.
51
53 Refer to sigaction(2).
54
56 This function is a direct replacement for the BSD signal(3UCB) function
57 for simple applications that are installing a single-argument signal
58 handler function. If a BSD signal handler function is being installed
59 that expects more than one argument, the application has to be modified
60 to use sigaction(2). The bsd_signal() function differs from sig‐
61 nal(3UCB) in that the SA_RESTART flag is set and the SA_RESETHAND will
62 be clear when bsd_signal() is used. The state of these flags is not
63 specified for signal(3UCB).
64
66 See attributes(5) for descriptions of the following attributes:
67
68
69
70
71 ┌─────────────────────────────┬─────────────────────────────┐
72 │ATTRIBUTE TYPE │ATTRIBUTE VALUE │
73 ├─────────────────────────────┼─────────────────────────────┤
74 │Interface Stability │Standard │
75 └─────────────────────────────┴─────────────────────────────┘
76
78 sigaction(2), sigaddset(3C), sigemptyset(3C), signal(3UCB),
79 attributes(5), standards(5)
80
81
82
83SunOS 5.11 24 Jul 2002 bsd_signal(3C)