From 4f64ef0f835d44c9a3220c414a6f35d05cb47690 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sat, 9 Apr 2022 19:09:31 +0200 Subject: kernel: prevent switching processes in syscall handlers --- src/kernel/syscalls.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/kernel') diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index 855fad8..85db57a 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -27,11 +27,11 @@ int _syscall_await(void) { has_children = true; } - if (has_children) - process_switch_any(); // wait until a child dies - else { + if (!has_children) { process_current->state = PS_RUNNING; return ~0; // TODO errno + } else { + return -1; } } @@ -217,9 +217,8 @@ int _syscall_fs_wait(char __user *buf, int max_len, struct fs_wait_response __us struct process *queued = backend->queue; backend->queue = queued->waits4fs.queue_next; return vfs_request_accept(&queued->waits4fs.req); - } else { - process_switch_any(); } + return -1; } int _syscall_fs_respond(char __user *buf, int ret) { -- cgit v1.2.3