|
|
1.1 ! root 1: /* x_kill.c - x_kill */ ! 2: ! 3: #include <conf.h> ! 4: #include <kernel.h> ! 5: #include <shell.h> ! 6: ! 7: /*------------------------------------------------------------------------ ! 8: * x_kill - (command kill) terminate a process ! 9: *------------------------------------------------------------------------ ! 10: */ ! 11: BUILTIN x_kill(stdin, stdout, stderr, nargs, args) ! 12: int stdin, stdout, stderr, nargs; ! 13: char *args[]; ! 14: { ! 15: int pid; ! 16: ! 17: if (nargs != 2) { ! 18: fprintf(stderr, "use: kill process-id\n"); ! 19: return(SYSERR); ! 20: } ! 21: if ( (pid=atoi(args[1])) == getpid() ) ! 22: fprintf(stderr, "Shell killed\n"); ! 23: return( kill(pid) ); ! 24: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.