diff options
author | dzwdz | 2023-01-25 20:16:22 +0100 |
---|---|---|
committer | dzwdz | 2023-01-25 20:16:22 +0100 |
commit | 17bfb0ef0a48330b1d54e61fe3c30d83528d2d90 (patch) | |
tree | b3d4aed1f408edcb17fe5c86fccaeacaa2a5a48a /src/user/app/init/init.c | |
parent | 2ad6ee8ed15d1bf898645a16dbc06991a3c1425e (diff) |
style: typedef structs, shorter namespaces
I've wanted to do this for a while, and since I've just had a relatively
large refactor commit (pcpy), this is as good of a time as any.
Typedefing structs was mostly inspired by Plan 9's coding style. It makes
some lines of code much shorter at basically no expense.
Everything related to userland kept old-style struct definitions, so as not
to force that style onto other people.
I also considered changing SCREAMING_ENUM_FIELDS to NicerLookingCamelcase,
but I didn't, just in case that'd be confusing.
Diffstat (limited to 'src/user/app/init/init.c')
-rw-r--r-- | src/user/app/init/init.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/user/app/init/init.c b/src/user/app/init/init.c index d872b24..8346a31 100644 --- a/src/user/app/init/init.c +++ b/src/user/app/init/init.c @@ -26,18 +26,18 @@ void redirect(const char *exe, const char *out, const char *in) { termcook(); execv(exe, (void*)argv); fprintf(stderr, "init: couldn't start %s\n", exe); - _syscall_sleep(5000); + _sys_sleep(5000); exit(1); } - _syscall_await(); - _syscall_intr(); + _sys_await(); + _sys_intr(); } } } int main(void) { const char *teststr = "I am teststr.\n"; - handle_t killswitch_pipe[2]; + hid_t killswitch_pipe[2]; freopen("/kdev/com1", "a+", stdout); freopen("/kdev/com1", "a+", stderr); @@ -86,7 +86,7 @@ int main(void) { execv(argv[0], (void*)argv); } - if (_syscall_pipe(killswitch_pipe, 0) < 0) { + if (_sys_pipe(killswitch_pipe, 0) < 0) { printf("couldn't create the killswitch pipe, quitting...\n"); return 1; } @@ -106,20 +106,20 @@ int main(void) { char buf[128]; for (;;) { - if (_syscall_read(killswitch_pipe[0], buf, 128, 0) != 4) { + if (_sys_read(killswitch_pipe[0], buf, 128, 0) != 4) { break; } if (memcmp(buf, "intr", 4) == 0) { - _syscall_intr(); + _sys_intr(); } else if (memcmp(buf, "halt", 4) == 0) { break; } } printf("[init] intr\n"); - _syscall_intr(); - _syscall_sleep(1000); + _sys_intr(); + _sys_sleep(1000); printf("[init] filicide\n"); - _syscall_filicide(); + _sys_filicide(); printf("[init] goodbye\n"); return 0; } |