source: trunk/libs/newlib/src/newlib/libc/signal/raise.c @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.5 KB
Line 
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/*
7FUNCTION
8<<raise>>---send a signal
9
10INDEX
11        raise
12INDEX
13        _raise_r
14
15SYNOPSIS
16        #include <signal.h>
17        int raise(int <[sig]>);
18
19        int _raise_r(void *<[reent]>, int <[sig]>);
20
21DESCRIPTION
22Send the signal <[sig]> (one of the macros from `<<sys/signal.h>>').
23This interrupts your program's normal flow of execution, and allows a signal
24handler (if you've defined one, using <<signal>>) to take control.
25
26The alternate function <<_raise_r>> is a reentrant version.  The extra
27argument <[reent]> is a pointer to a reentrancy structure.
28
29RETURNS
30The result is <<0>> if <[sig]> was successfully raised, <<1>>
31otherwise.  However, the return value (since it depends on the normal
32flow of execution) may not be visible, unless the signal handler for
33<[sig]> terminates with a <<return>> or unless <<SIG_IGN>> is in
34effect for this signal.
35
36PORTABILITY
37ANSI C requires <<raise>>, but allows the full set of signal numbers
38to vary from one implementation to another.
39
40Required OS subroutines: <<getpid>>, <<kill>>.
41*/
42
43#ifndef SIGNAL_PROVIDED
44
45int _dummy_raise;
46
47#else
48
49#include <reent.h>
50#include <signal.h>
51
52#ifndef _REENT_ONLY
53
54int
55raise (int sig)
56{
57  return _raise_r (_REENT, sig);
58}
59
60#endif
61
62int
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 */
Note: See TracBrowser for help on using the repository browser.