c0814fad0ddfc886c00925aa81e0a7e9ec2a2098
[musl] / src / signal / raise.c
1 #include <signal.h>
2 #include <errno.h>
3 #include <stdint.h>
4 #include "syscall.h"
5 #include "pthread_impl.h"
6
7 int raise(int sig)
8 {
9         int pid, tid, ret;
10         sigset_t set;
11         __syscall(SYS_rt_sigprocmask, SIG_BLOCK, SIGALL_SET, &set, __SYSCALL_SSLEN);
12         tid = syscall(SYS_gettid);
13         pid = syscall(SYS_getpid);
14         ret = syscall(SYS_tgkill, pid, tid, sig);
15         __syscall(SYS_rt_sigprocmask, SIG_SETMASK, &set, 0, __SYSCALL_SSLEN);
16         return ret;
17 }