shithub: scc

ref: dafc7b4128023928611008473fd07e0ab7a0bbd8
dir: /lib/c/target/posix/signal.c/

View raw version

#include <stddef.h>
#include <signal.h>
#include <sys.h>

#include "../../syscall.h"

#undef signal

void
(*signal(int signum, void (*func)(int)))(int)
{
	struct sigaction sa = {
		.sa_handler = func,
	};

	if (_sigaction(signum, &sa, &sa) < 0)
		return SIG_ERR;

	return sa.sa_handler;
}