diff options
Diffstat (limited to 'src/kernel/syscalls.c')
-rw-r--r-- | src/kernel/syscalls.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index d39aed9..a5c6f43 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -236,7 +236,16 @@ int _syscall_fs_respond(char __user *buf, int ret) { struct vfs_request *req = process_current->handled_req; if (!req) return -1; - // TODO copy buffer + if (req->output.len > 0 && ret > 0) { + // if this vfsop outputs data and ret is positive, it's the length of the buffer + // TODO document + if (ret > req->output.len) + ret = req->output.len; // i'm not handling this in a special way - the fs server can prevent this on its own + if (!virt_cpy(req->caller->pages, req->output.buf, + process_current->pages, buf, ret)) { + // how should this error even be handled? TODO + } + } process_current->handled_req = NULL; vfs_request_finish(req, ret); |