summaryrefslogtreecommitdiff
path: root/src/signal/raise.c
blob: 04bed49812c27bb37c072526e812396a285d3778 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#if defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || defined _XOPEN_SOURCE
#include "sys/types.h"
#include "unistd.h"
#else
#include "_syscall.h"
#define kill(pid, sig) __syscall(__syscall_lookup(kill), pid, sig)
#define getpid() __syscall(__syscall_lookup(getpid))
#endif
#include <signal.h>

/** send a signal to the current program **/
int raise(int sig)
{
	/*
	RETURN_FAILURE(NONZERO);
	RETURN_SUCCESS(0);
	*/
	#if (defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 199506L)
	return pthread_kill(pthread_self(), sig);
	#else
	return kill(getpid(), sig);
	#endif
}

/***
sends the signal ARGUMENT(sig) to the current program.
***/
/*
STDC(1)
*/