From a66ce8238c08703bd1066a8094d6ab537e82b20e Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sun, 12 Sep 2021 13:26:29 +0200 Subject: implement most of fs_wait awaited_req is a garbage name but i couldn't come up with a better one. i also have no idea how to handle all the failure states --- src/init/main.c | 5 ++++- src/init/syscalls.c | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src/init') diff --git a/src/init/main.c b/src/init/main.c index 8d677af..01e2285 100644 --- a/src/init/main.c +++ b/src/init/main.c @@ -28,14 +28,17 @@ int main(void) { } void fs_test(void) { + static char buf[64] __attribute__((section("text"))); + int len = 64; handle_t front, back, file; front = _syscall_fs_create((void*)&back); // TODO change user_ptr to void* if (_syscall_fork()) { // child: is the fs server log("fs_wait started. "); - _syscall_fs_wait(back, NULL); + _syscall_fs_wait(back, buf, &len); log("fs_wait returned. "); + _syscall_write(tty_fd, buf, len); } else { // parent: accesses the fs _syscall_mount(front, argify("/mnt")); diff --git a/src/init/syscalls.c b/src/init/syscalls.c index 4584837..e63f911 100644 --- a/src/init/syscalls.c +++ b/src/init/syscalls.c @@ -41,6 +41,6 @@ handle_t _syscall_fs_create(handle_t __user *back) { return _syscall(_SYSCALL_FS_CREATE, (int)back, 0, 0); } -int _syscall_fs_wait(handle_t back, void __user *info) { - return _syscall(_SYSCALL_FS_WAIT, back, (int)info, 0); +int _syscall_fs_wait(handle_t back, char __user *buf, int __user *len) { + return _syscall(_SYSCALL_FS_WAIT, back, (int)buf, (int)len); } -- cgit v1.2.3