00001 /* src_experimental/libc/kill.c 00002 CubeOS Version 0.4.90 experimental 00003 Copyright (C) 1999,2000 Holger Kenn 00004 00005 CubeOS is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or any later version. 00009 00010 CubeOS is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 */ 00016 /* kill.c -- signal to a process. 00017 00018 */ 00019 00024 #include <sys_var.h> 00025 #include <schedule.h> 00026 00034 int kill (int pid, int sig) 00035 { 00036 00037 if (pid > MAX_PROCESSNUM) 00038 return (-1); 00039 if (pid < 0) 00040 return (-1); 00041 if (_KERN_ptable[pid].state == STATE_EMPTY) 00042 return (-1); 00043 if (sig < 0) 00044 return (-1); 00045 if (sig > 31) 00046 return (-1); 00047 _KERN_ptable[pid].signal |= (1 << sig); 00048 return 0; 00049 }