summaryrefslogtreecommitdiff
path: root/lib/libc/signal/pthread_kill.c
blob: f5a2a99138191eb90c1ca220faddd93643c5840e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "errno.h" // for EINVAL

#include <__thread.h>		// for __thread_self
#include <asm-generic/signal.h> // for _NSIG
#include <syscall.h>		// for __syscall_2, syscall

typedef struct __thread_self *pthread_t;

int pthread_kill(pthread_t thread, int sig)
{
	if (sig < 0 || sig > _NSIG) {
		return EINVAL;
	}

	if (thread->tid == 0) {
		return 0;
	}

	return syscall(tkill, thread->tid, sig);
}