1 | /* Embedded systems may want the simulated signals if no other form exists, |
---|
2 | but UNIX versions will want to use the host facilities. |
---|
3 | Define SIMULATED_SIGNALS when you want to use the simulated versions. |
---|
4 | */ |
---|
5 | |
---|
6 | /* |
---|
7 | FUNCTION |
---|
8 | <<raise>>---send a signal |
---|
9 | |
---|
10 | INDEX |
---|
11 | raise |
---|
12 | INDEX |
---|
13 | _raise_r |
---|
14 | |
---|
15 | SYNOPSIS |
---|
16 | #include <signal.h> |
---|
17 | int raise(int <[sig]>); |
---|
18 | |
---|
19 | int _raise_r(void *<[reent]>, int <[sig]>); |
---|
20 | |
---|
21 | DESCRIPTION |
---|
22 | Send the signal <[sig]> (one of the macros from `<<sys/signal.h>>'). |
---|
23 | This interrupts your program's normal flow of execution, and allows a signal |
---|
24 | handler (if you've defined one, using <<signal>>) to take control. |
---|
25 | |
---|
26 | The alternate function <<_raise_r>> is a reentrant version. The extra |
---|
27 | argument <[reent]> is a pointer to a reentrancy structure. |
---|
28 | |
---|
29 | RETURNS |
---|
30 | The result is <<0>> if <[sig]> was successfully raised, <<1>> |
---|
31 | otherwise. However, the return value (since it depends on the normal |
---|
32 | flow of execution) may not be visible, unless the signal handler for |
---|
33 | <[sig]> terminates with a <<return>> or unless <<SIG_IGN>> is in |
---|
34 | effect for this signal. |
---|
35 | |
---|
36 | PORTABILITY |
---|
37 | ANSI C requires <<raise>>, but allows the full set of signal numbers |
---|
38 | to vary from one implementation to another. |
---|
39 | |
---|
40 | Required OS subroutines: <<getpid>>, <<kill>>. |
---|
41 | */ |
---|
42 | |
---|
43 | #ifndef SIGNAL_PROVIDED |
---|
44 | |
---|
45 | int _dummy_raise; |
---|
46 | |
---|
47 | #else |
---|
48 | |
---|
49 | #include <reent.h> |
---|
50 | #include <signal.h> |
---|
51 | |
---|
52 | #ifndef _REENT_ONLY |
---|
53 | |
---|
54 | int |
---|
55 | raise (int sig) |
---|
56 | { |
---|
57 | return _raise_r (_REENT, sig); |
---|
58 | } |
---|
59 | |
---|
60 | #endif |
---|
61 | |
---|
62 | int |
---|
63 | _raise_r (struct _reent *reent, |
---|
64 | int sig) |
---|
65 | { |
---|
66 | return _kill_r (reent, _getpid_r (reent), sig); |
---|
67 | } |
---|
68 | |
---|
69 | #endif /* SIGNAL_PROVIDED */ |
---|