xref: /haiku/src/system/libroot/posix/signal/kill.c (revision 1acbe440b8dd798953bec31d18ee589aa3f71b73)
1 /*
2  * Copyright 2004-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include <OS.h>
8 
9 #include <signal.h>
10 #include <errno.h>
11 
12 
13 int
14 kill(pid_t pid, int sig)
15 {
16 	status_t status = send_signal(pid, (uint)sig);
17 	if (status < B_OK) {
18 		if (status == B_BAD_THREAD_ID)
19 			status = ESRCH;
20 
21 		errno = status;
22 		return -1;
23 	}
24 
25 	return 0;
26 }
27