From 93af95b3419edfc127c6ea4245753540190c520e Mon Sep 17 00:00:00 2001 From: dzwdz Date: Mon, 11 Jul 2022 22:21:57 +0200 Subject: user: add shorthand close() and fork() wrappers for those syscalls --- src/user/app/main.c | 6 +++--- src/user/app/shell.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/user/app') diff --git a/src/user/app/main.c b/src/user/app/main.c index e59b5a6..f87133e 100644 --- a/src/user/app/main.c +++ b/src/user/app/main.c @@ -37,7 +37,7 @@ int main(void) { MOUNT("/bind/", fs_passthru(NULL)); - if (_syscall_fork(0, NULL)) { + if (fork()) { /* (used to) expose a bug in the kernel * the program will flow like this: * 1. we launch the forked init @@ -54,7 +54,7 @@ int main(void) { _syscall_exit(1); } - if (!_syscall_fork(0, NULL)) { + if (!fork()) { if (!file_reopen(stdout, "/kdev/com1", 0)) { printf("couldn't open /kdev/com1\n"); // TODO borked _syscall_exit(1); @@ -69,7 +69,7 @@ int main(void) { } - if (!_syscall_fork(0, NULL)) { + if (!fork()) { if (!file_reopen(stdout, "/vga_tty", 0)) { printf("couldn't open /vga_tty\n"); // TODO borked _syscall_exit(1); diff --git a/src/user/app/shell.c b/src/user/app/shell.c index 0a8c44f..5bab2ab 100644 --- a/src/user/app/shell.c +++ b/src/user/app/shell.c @@ -111,7 +111,7 @@ static void cmd_hexdump(const char *args) { printf("|\n"); } - _syscall_close(fd); + close(fd); } static void cmd_touch(const char *args) { @@ -120,7 +120,7 @@ static void cmd_touch(const char *args) { printf("couldn't create file.\n"); return; } - _syscall_close(fd); + close(fd); } void shell_loop(void) { @@ -157,7 +157,7 @@ void shell_loop(void) { } else if (!strcmp(cmd, "exit")) { _syscall_exit(0); } else if (!strcmp(cmd, "fork")) { - if (_syscall_fork(0, NULL)) + if (fork()) _syscall_await(); else level++; } else if (!strcmp(cmd, "run_tests")) { -- cgit v1.2.3