summaryrefslogtreecommitdiff
path: root/src/signal/raise.c
blob: 71e0505b0f598d1c3184e3f38cd78d57204a05ad (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <signal.h>
#include <errno.h>
#include <stdint.h>
#include "syscall.h"

int raise(int sig)
{
	int pid, tid, ret;
	sigset_t set;
	__syscall(SYS_rt_sigprocmask, SIG_BLOCK, (uint64_t[]){-1}, &set, 8);
	tid = syscall(SYS_gettid);
	pid = syscall(SYS_getpid);
	ret = syscall(SYS_tgkill, pid, tid, sig);
	__syscall(SYS_rt_sigprocmask, SIG_SETMASK, &set, 0, 8);
	return ret;
}