about summary refs log tree commit diff
path: root/src/signal/sigqueue.c
blob: bdb12856a965ef14f86667265b80e5d70281c3b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <signal.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include "syscall.h"

int sigqueue(pid_t pid, int sig, const union sigval value)
{
	siginfo_t si;
	sigset_t set;
	int r;
	memset(&si, 0, sizeof si);
	si.si_signo = sig;
	si.si_code = SI_QUEUE;
	si.si_value = value;
	si.si_uid = getuid();
	pthread_sigmask(SIG_BLOCK, (void *)(uint64_t[1]){-1}, &set);
	si.si_pid = getpid();
	r = syscall(SYS_rt_sigqueueinfo, pid, sig, &si);
	pthread_sigmask(SIG_SETMASK, &set, 0);
	return r;
}