From 2d3597c3a02f821bb364b8ecc23fc5949fca738d Mon Sep 17 00:00:00 2001 From: user Date: Thu, 16 Jul 2026 11:10:45 +0200 Subject: kill + ps: implement SYS_KILL (pid 1 immortal) and a ps tool - PCB gains PROC_PROG (running program id), set by exec, inherited on fork. - sys_kill(pid): reject pid 1 (immortal) and unknown/dead pids; mark the target zombie, reparent its children to init, wake its parent if blocked in wait; schedule away if a process kills itself. Reuses FindPcbByPid/ReparentToInit. - sys_ps(slot,buf)->{pid,state,prog}; sys_progname(id) via NameTable reverse lookup. NameTable gains sh/ps/kill. - libc: kill/psget/progname; tools ps (pid state cmd) and kill . - verified: ps lists sh(B)+ps(R); kill 1 refused; kill 42 fails. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 9b871fa..e2a86eb 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ $(BUILD)/%.o: src/%.asm | $(BUILD) # C programs: compiled with SDCC into ROM-bank blobs and INCBIN'd by programs.asm CBLOBS := c/chello.bin c/echo.bin c/true.bin c/false.bin c/uname.bin \ c/pid.bin c/cat.bin c/wc.bin c/head.bin c/args.bin \ - c/ls.bin c/save.bin c/rm.bin c/sh.bin + c/ls.bin c/save.bin c/rm.bin c/sh.bin c/ps.bin c/kill.bin $(BUILD)/programs.o: $(CBLOBS) # C programs also depend on the shared libc sources -- cgit v1.3.1-sl0p