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/pipe.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/kernel/pipe.c') diff --git a/src/kernel/pipe.c b/src/kernel/pipe.c index edd1388..2dc98fe 100644 --- a/src/kernel/pipe.c +++ b/src/kernel/pipe.c @@ -27,6 +27,7 @@ bool pipe_joinqueue(struct handle *h, bool wants_write, void pipe_trytransfer(struct handle *h) { struct process *rdr, *wtr; + struct virt_cpy_error cpyerr; int len; assert(h); if (!h->pipe.sister) { @@ -43,12 +44,12 @@ void pipe_trytransfer(struct handle *h) { len = min(rdr->waits4pipe.len, wtr->waits4pipe.len); - if (!virt_cpy( + virt_cpy( rdr->pages, rdr->waits4pipe.buf, - wtr->pages, wtr->waits4pipe.buf, len)) - { + wtr->pages, wtr->waits4pipe.buf, + len, &cpyerr); + if (cpyerr.read_fail || cpyerr.write_fail) panic_unimplemented(); - } h->pipe.queued = h->pipe.queued->waits4pipe.next; h->pipe.sister->pipe.queued = h->pipe.sister->pipe.queued->waits4pipe.next; process_transition(rdr, PS_RUNNING); -- cgit v1.2.3