summaryrefslogtreecommitdiff
path: root/src/kernel/syscalls.c
diff options
context:
space:
mode:
authordzwdz2021-09-16 06:42:07 +0000
committerdzwdz2021-09-16 06:42:07 +0000
commit267a85f9ef709ccbefe5ae0ccbb306bd21921418 (patch)
treef5ed73b0fdb5500bc81ed790c69d8b2764f0ad32 /src/kernel/syscalls.c
parent206ca77636cca94d14d7486a7a0e2679bf107a28 (diff)
implement output from vfs calls
Diffstat (limited to 'src/kernel/syscalls.c')
-rw-r--r--src/kernel/syscalls.c11
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);