From 2c78dc983d09e136dd016ae6ecee6b191e033de1 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Mon, 25 Sep 2023 00:12:57 +0200 Subject: kernel/intr: accept a message, allow killing processes via intrs --- src/kernel/proc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/kernel/proc.c') diff --git a/src/kernel/proc.c b/src/kernel/proc.c index 0ce0f50..dc17af2 100644 --- a/src/kernel/proc.c +++ b/src/kernel/proc.c @@ -382,7 +382,14 @@ void proc_tryintr(Proc *p) { } } -void proc_intr(Proc *p) { +void proc_intr(Proc *p, const char *buf, size_t len) { + assert(buf != NULL || len == 0); + + if (4 <= len && memcmp(buf, "kill", 4) == 0) { + proc_kill(p, EINTR); + return; + } + if (!p->intr_fn) return; proc_tryintr(p); -- cgit v1.2.3