From e0924827eef75ac29f17909c6f932222eda72fbd Mon Sep 17 00:00:00 2001 From: rsc Date: Wed, 8 Aug 2007 08:50:23 +0000 Subject: [PATCH] add kill --- Makefile | 12 ++++++++---- kill.c | 17 +++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 kill.c diff --git a/Makefile b/Makefile index 9a2db84..2606f4c 100644 --- a/Makefile +++ b/Makefile @@ -84,9 +84,9 @@ _init : init.o $(ULIB) $(OBJDUMP) -S _init > init.asm $(OBJDUMP) -t _init | awk '/SYMBOL TABLE/ { go=1; next } go {print $$1, $$NF}' >init.sym -_sh : sh.o $(ULIB) - $(LD) -N -e main -Ttext 0 -o _sh sh.o $(ULIB) - $(OBJDUMP) -S _sh > sh.asm +_kill : kill.o $(ULIB) + $(LD) -N -e main -Ttext 0 -o _kill kill.o $(ULIB) + $(OBJDUMP) -S _kill > kill.asm _ls : ls.o $(ULIB) $(LD) -N -e main -Ttext 0 -o _ls ls.o $(ULIB) @@ -100,6 +100,10 @@ _rm : rm.o $(ULIB) $(LD) -N -e main -Ttext 0 -o _rm rm.o $(ULIB) $(OBJDUMP) -S _rm > rm.asm +_sh : sh.o $(ULIB) + $(LD) -N -e main -Ttext 0 -o _sh sh.o $(ULIB) + $(OBJDUMP) -S _sh > sh.asm + _zombie: zombie.o $(ULIB) $(LD) -N -e main -Ttext 0 -o _zombie zombie.o $(ULIB) $(OBJDUMP) -S _zombie > zombie.asm @@ -107,7 +111,7 @@ _zombie: zombie.o $(ULIB) mkfs : mkfs.c fs.h cc -o mkfs mkfs.c -UPROGS=usertests _echo _cat _init _sh _ls _mkdir _rm _zombie +UPROGS=usertests _echo _cat _init _kill _ls _mkdir _rm _sh _zombie fs.img : mkfs README $(UPROGS) ./mkfs fs.img README $(UPROGS) diff --git a/kill.c b/kill.c new file mode 100644 index 0000000..2d69d4d --- /dev/null +++ b/kill.c @@ -0,0 +1,17 @@ +#include "types.h" +#include "stat.h" +#include "user.h" + +int +main(int argc, char **argv) +{ + int i; + + if(argc < 1){ + printf(2, "usage: kill pid...\n"); + exit(); + } + for(i=1; i