summaryrefslogblamecommitdiff
path: root/src/signal/signal.c
blob: c0f063edb2fa8137f0fd77a91b4d67b03708dc36 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                   
                    
                 




                                                                   

                                                                                     
                               
                                 
 

                               
#include <signal.h>
#include "syscall.h"
#include "libc.h"

int __sigaction(int, const struct sigaction *, struct sigaction *);

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);