diff options
author | dzwdz | 2022-07-10 11:30:06 +0200 |
---|---|---|
committer | dzwdz | 2022-07-10 11:30:06 +0200 |
commit | f6039ca691352bce5d050a4e5ffa768fadbaf68c (patch) | |
tree | 1d1d071e2f5d9b2097f8d751726665a3cc1e4eb6 | |
parent | fff36661c92f30685e2d83825a11b67ad8921a0e (diff) |
kernel: implement killing processes stuck on pipes
-rw-r--r-- | src/kernel/proc.c | 11 |
1 files 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]); |