From c6bbf615e5c77ec273b954c11cef95df3d6f7286 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sun, 17 Jul 2022 20:28:53 +0200 Subject: kernel/virt_cpy: error struct, better error handling --- src/kernel/syscalls.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/kernel/syscalls.c') diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index c5e12b4..786578a 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -292,10 +292,13 @@ long _syscall_fs_respond(void __user *buf, long ret, int flags) { // if this vfsop outputs data and ret is positive, it's the length of the buffer // TODO document ret = min(ret, capped_cast32(req->output.len)); - if (!virt_cpy(req->caller->pages, req->output.buf, - process_current->pages, buf, ret)) { - // how should this error even be handled? TODO - } + struct virt_cpy_error err; + virt_cpy(req->caller->pages, req->output.buf, + process_current->pages, buf, ret, &err); + + if (err.read_fail) + panic_unimplemented(); + /* write failures are ignored */ } process_current->handled_req = NULL; -- cgit v1.2.3