vfs: check userland buffers before reading them.
[haiku.git] / src / system / libroot / posix / signal / kill.c
blob999366a23a9cb74645fe7d9a954f177e5fdd135a
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 */
7 #include <errno.h>
8 #include <signal.h>
10 #include <OS.h>
12 #include <errno_private.h>
13 #include <syscalls.h>
16 int
17 kill(pid_t pid, int sig)
19 status_t status;
21 if (sig < 0) {
22 __set_errno(EINVAL);
23 return -1;
26 status = _kern_send_signal(pid, sig, NULL, 0);
27 if (status != B_OK) {
28 // translate B_BAD_THREAD_ID/B_BAD_TEAM_ID to ESRCH
29 if (status == B_BAD_THREAD_ID || status == B_BAD_TEAM_ID)
30 status = ESRCH;
32 __set_errno(status);
33 return -1;
36 return 0;