summaryrefslogtreecommitdiff
path: root/src/user/lib/compat.c
diff options
context:
space:
mode:
authordzwdz2022-08-19 19:44:36 +0200
committerdzwdz2022-08-19 19:44:36 +0200
commit390aec5ca22e62d128e71d1dee312a2f0a82ab68 (patch)
tree2a79bb1ee35dab3006a947f595891fbcfefa4bfb /src/user/lib/compat.c
parent6bea8cd391125734339dfb83db498a8651c9f7f7 (diff)
syscall/fs_wait: return a handle for each request
Diffstat (limited to 'src/user/lib/compat.c')
-rw-r--r--src/user/lib/compat.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/user/lib/compat.c b/src/user/lib/compat.c
new file mode 100644
index 0000000..cadc77f
--- /dev/null
+++ b/src/user/lib/compat.c
@@ -0,0 +1,20 @@
+#include <camellia/syscalls.h>
+#include <stdio.h>
+#include <user/lib/compat.h>
+
+#define eprintf(fmt, ...) fprintf(stderr, "user/lib/compat: "fmt"\n" __VA_OPT__(,) __VA_ARGS__)
+
+static handle_t h = -1;
+long c0_fs_wait(char *buf, long len, struct fs_wait_response *res) {
+ if (h != -1) {
+ eprintf("didn't respond to request!");
+ c0_fs_respond(NULL, -1, 0);
+ }
+ h = _syscall_fs_wait(buf, len, res);
+ return h >= 0 ? 0 : -1;
+}
+long c0_fs_respond(void *buf, long ret, int flags) {
+ ret = _syscall_fs_respond(h, buf, ret, flags);
+ h = -1;
+ return ret;
+}