ref: 2e7e4ca6b9def1b7bae6b93285f6431039f9656a
dir: /src/libc/arch/posix/signal.c/
#include <signal.h>
#include <stddef.h>
#include <arch/sigaction.h>
#include <sys.h>
#undef signal
void
(*signal(int signum, void (*func)(int)))(int)
{
struct sigaction osa, sa = {
.sa_handler = func,
};
if (_sigaction(signum, &sa, &osa) < 0)
return SIG_ERR;
return osa.sa_handler;
}