Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / signal / raise.c
blobc678c6e2d20b0b797c4a0b139c390e814f4881e4
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 */
6 /*
7 FUNCTION
8 <<raise>>---send a signal
10 INDEX
11 raise
12 INDEX
13 _raise_r
15 SYNOPSIS
16 #include <signal.h>
17 int raise(int <[sig]>);
19 int _raise_r(void *<[reent]>, int <[sig]>);
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.
26 The alternate function <<_raise_r>> is a reentrant version. The extra
27 argument <[reent]> is a pointer to a reentrancy structure.
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.
36 PORTABILITY
37 ANSI C requires <<raise>>, but allows the full set of signal numbers
38 to vary from one implementation to another.
40 Required OS subroutines: <<getpid>>, <<kill>>.
43 #ifndef SIGNAL_PROVIDED
45 int _dummy_raise;
47 #else
49 #include <reent.h>
50 #include <signal.h>
52 #ifndef _REENT_ONLY
54 int
55 raise (int sig)
57 return _raise_r (_REENT, sig);
60 #endif
62 int
63 _raise_r (struct _reent *reent,
64 int sig)
66 return _kill_r (reent, _getpid_r (reent), sig);
69 #endif /* SIGNAL_PROVIDED */