summaryrefslogtreecommitdiff
path: root/src/signal/raise.c
blob: 9948f4189bc7dce65196fa8652c4f0c95998200f (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 = syscall(SYS_gettid);
	pid = syscall(SYS_getpid);
	ret = syscall(SYS_tgkill, pid, tid, sig);
	__sigprocmask(SIG_SETMASK, &set, 0);
	return ret;
}