diff options
Diffstat (limited to 'libc-top-half/musl/src/signal/signal.c')
-rw-r--r-- | libc-top-half/musl/src/signal/signal.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/signal/signal.c b/libc-top-half/musl/src/signal/signal.c new file mode 100644 index 0000000..7a6dd17 --- /dev/null +++ b/libc-top-half/musl/src/signal/signal.c @@ -0,0 +1,13 @@ +#include <signal.h> +#include "syscall.h" + +void (*signal(int sig, void (*func)(int)))(int) +{ + struct sigaction sa_old, sa = { .sa_handler = func, .sa_flags = SA_RESTART }; + if (__sigaction(sig, &sa, &sa_old) < 0) + return SIG_ERR; + return sa_old.sa_handler; +} + +weak_alias(signal, bsd_signal); +weak_alias(signal, __sysv_signal); |