shithub: scc

ref: d764f1b643106a1e028f18104fe458a53ee39913
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,
		.sa_flags = 0,
	};

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

	return sa.sa_handler;
}