summaryrefslogtreecommitdiff
path: root/src/init/fs
diff options
context:
space:
mode:
authordzwdz2022-04-10 16:05:22 +0200
committerdzwdz2022-04-10 16:05:22 +0200
commit1677ac032bb89f87456ac5668118f0091ae5ed9f (patch)
treea2319568e1c8ddc2a77c07ca9f0727efd721e435 /src/init/fs
parent3e7d1acffd81175246fab1ed8be30569c9cd3289 (diff)
init/fs: handle delegated reads in a subprocess
first off: this is horrible. there's no CoW, so this is horribly slow. the sole purpose of this is to let the userland delegate handle multiple requests at once, because i'm implementing concurrent IO and I kinda need that. it's possible that handling of multiple requests could be handled in a better way - but this could be good enough once i implement CoW
Diffstat (limited to 'src/init/fs')
-rw-r--r--src/init/fs/misc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/init/fs/misc.c b/src/init/fs/misc.c
index 2f02e09..dc14ac4 100644
--- a/src/init/fs/misc.c
+++ b/src/init/fs/misc.c
@@ -52,10 +52,16 @@ static void fs_respond_delegate(struct fs_wait_response *res, handle_t delegate,
switch (res->op) {
case VFSOP_READ:
+ if (_syscall_fork()) {
+ // handle reads in a child
+ // this is a HORRIBLE workaround for making concurrent IO work without proper delegates
+ break;
+ }
// TODO instead of truncating the size, allocate a bigger buffer
size = res->capacity < sizeof(buf) ? res->capacity : sizeof(buf);
ret = _syscall_read(delegate, buf, size, res->offset);
_syscall_fs_respond(buf, ret);
+ _syscall_exit(0); // TODO unreapable - add a nonblocking reap syscall
break;
// TODO proper writing (see above)