summaryrefslogtreecommitdiff
path: root/src/init
diff options
context:
space:
mode:
Diffstat (limited to 'src/init')
-rw-r--r--src/init/main.c14
-rw-r--r--src/init/syscalls.c4
2 files changed, 16 insertions, 2 deletions
diff --git a/src/init/main.c b/src/init/main.c
index 41f51d3..8d677af 100644
--- a/src/init/main.c
+++ b/src/init/main.c
@@ -30,8 +30,18 @@ int main(void) {
void fs_test(void) {
handle_t front, back, file;
front = _syscall_fs_create((void*)&back); // TODO change user_ptr to void*
- _syscall_mount(front, argify("/mnt"));
- file = _syscall_open(argify("/mnt/test"));
+
+ if (_syscall_fork()) {
+ // child: is the fs server
+ log("fs_wait started. ");
+ _syscall_fs_wait(back, NULL);
+ log("fs_wait returned. ");
+ } else {
+ // parent: accesses the fs
+ _syscall_mount(front, argify("/mnt"));
+ log("requesting file. ");
+ file = _syscall_open(argify("/mnt/test"));
+ }
}
void misc_tests(void) {
diff --git a/src/init/syscalls.c b/src/init/syscalls.c
index 4c645c2..c091247 100644
--- a/src/init/syscalls.c
+++ b/src/init/syscalls.c
@@ -40,3 +40,7 @@ int _syscall_close(handle_t handle) {
handle_t _syscall_fs_create(user_ptr back) {
return _syscall(_SYSCALL_FS_CREATE, (int)back, 0, 0);
}
+
+int _syscall_fs_wait(handle_t back, user_ptr info) {
+ return _syscall(_SYSCALL_FS_WAIT, back, info, 0);
+}