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

int raise(int sig)
{
	int pid, tid, ret;
	sigset_t set;
	__syscall(SYS_rt_sigprocmask, SIG_BLOCK, SIGALL_SET, &set, _NSIG/8);
	tid = syscall(SYS_gettid);
	pid = syscall(SYS_getpid);
	ret = syscall(SYS_tgkill, pid, tid, sig);
	__syscall(SYS_rt_sigprocmask, SIG_SETMASK, &set, 0, _NSIG/8);
	return ret;
}