Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / network / stacks / AROSTCP / netlib / kill.c
blobf6899be1eea285562065e14e389cde7484a7f93b
1 #include <dos/dos.h>
2 #include <exec/execbase.h>
3 #include <proto/exec.h>
4 #include <sys/signal.h>
5 #include <sys/types.h>
6 #include <errno.h>
8 BOOL CheckTask(struct List *tl, pid_t pid)
10 struct Node *t;
11 for (t = tl->lh_Head; t->ln_Succ; t = t->ln_Succ)
12 if ((pid_t)t == pid)
13 return TRUE;
14 return FALSE;
17 int kill(pid_t pid, int sigs)
19 ULONG exec_sigs;
20 int task_valid;
22 if ((pid == 0) || (sigs < 0))
23 return ESRCH;
24 switch (sigs) {
25 case SIGTERM:
26 exec_sigs = SIGBREAKF_CTRL_C;
27 case 0:
28 exec_sigs = 0;
29 break;
30 default:
31 return EINVAL;
33 Forbid();
34 task_valid = (CheckTask(&SysBase->TaskReady, pid) || CheckTask(&SysBase->TaskWait, pid));
35 if (task_valid && exec_sigs)
36 Signal((struct Task *)pid, exec_sigs);
37 Permit();
38 return task_valid ? 0 : ESRCH;