summaryrefslogtreecommitdiff
path: root/lib/libc/signal/pthread_kill.c
blob: 2c0bb40b78bb1ae2694f4a24542e8b57dea6ae38 (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);
}