shithub: scc

ref: ed1d2d62298cb6661c8cf31409f20c16c8c80851
dir: /src/libc/arch/posix/signal.c/

View raw version
#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;
}