From f6039ca691352bce5d050a4e5ffa768fadbaf68c Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sun, 10 Jul 2022 11:30:06 +0200 Subject: kernel: implement killing processes stuck on pipes --- src/kernel/proc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/kernel/proc.c b/src/kernel/proc.c index 86170aa..1cb6eb0 100644 --- a/src/kernel/proc.c +++ b/src/kernel/proc.c @@ -116,8 +116,15 @@ void process_kill(struct process *p, int ret) { if (p->state == PS_WAITS4FS) p->waits4fs.req->caller = NULL; - if (p->state == PS_WAITS4PIPE) - panic_unimplemented(); + if (p->state == PS_WAITS4PIPE) { + struct process **iter = &p->waits4pipe.pipe->pipe.queued; + while (*iter && *iter != p) { + assert((*iter)->state == PS_WAITS4PIPE); + iter = &(*iter)->waits4pipe.next; + } + assert(iter && *iter == p); + *iter = p->waits4pipe.next; + } for (handle_t h = 0; h < HANDLE_MAX; h++) handle_close(p->handles[h]); -- cgit v1.2.3