From f95a4a932476be2ba99e2fd081e8d2bc6ea12813 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 15 Dec 2017 09:38:53 -0500 Subject: Import newlib and create makefile --- newlib/libc/signal/raise.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 newlib/libc/signal/raise.c (limited to 'newlib/libc/signal/raise.c') diff --git a/newlib/libc/signal/raise.c b/newlib/libc/signal/raise.c new file mode 100644 index 0000000..bc47864 --- /dev/null +++ b/newlib/libc/signal/raise.c @@ -0,0 +1,80 @@ +/* Embedded systems may want the simulated signals if no other form exists, + but UNIX versions will want to use the host facilities. + Define SIMULATED_SIGNALS when you want to use the simulated versions. +*/ + +/* +FUNCTION +<>---send a signal + +INDEX + raise +INDEX + _raise_r + +ANSI_SYNOPSIS + #include + int raise(int <[sig]>); + + int _raise_r(void *<[reent]>, int <[sig]>); + +TRAD_SYNOPSIS + #include + int raise(<[sig]>) + int <[sig]>; + + int _raise_r(<[reent]>, <[sig]>) + char *<[reent]>; + int <[sig]>; + +DESCRIPTION +Send the signal <[sig]> (one of the macros from `<>'). +This interrupts your program's normal flow of execution, and allows a signal +handler (if you've defined one, using <>) to take control. + +The alternate function <<_raise_r>> is a reentrant version. The extra +argument <[reent]> is a pointer to a reentrancy structure. + +RETURNS +The result is <<0>> if <[sig]> was successfully raised, <<1>> +otherwise. However, the return value (since it depends on the normal +flow of execution) may not be visible, unless the signal handler for +<[sig]> terminates with a <> or unless <> is in +effect for this signal. + +PORTABILITY +ANSI C requires <>, but allows the full set of signal numbers +to vary from one implementation to another. + +Required OS subroutines: <>, <>. +*/ + +#ifndef SIGNAL_PROVIDED + +int _dummy_raise; + +#else + +#include +#include + +#ifndef _REENT_ONLY + +int +_DEFUN (raise, (sig), + int sig) +{ + return _raise_r (_REENT, sig); +} + +#endif + +int +_DEFUN (_raise_r, (reent, sig), + struct _reent *reent _AND + int sig) +{ + return _kill_r (reent, _getpid_r (reent), sig); +} + +#endif /* SIGNAL_PROVIDED */ -- cgit v1.2.3