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

int __sigprocmask(int, const sigset_t *, sigset_t *);

int raise(int sig)
{
	int pid, tid, ret;
	sigset_t set;
	sigfillset(&set);
	__sigprocmask(SIG_BLOCK, &set, &set);
	tid = syscall0(__NR_gettid);
	pid = syscall0(__NR_getpid);
	ret = syscall3(__NR_tgkill, pid, tid, sig);
	__sigprocmask(SIG_SETMASK, &set, 0);
	return ret;
}