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/tests/kernel/threads.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/tests/kernel/threads.c')
-rw-r--r-- | src/user/app/tests/kernel/threads.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/user/app/tests/kernel/threads.c b/src/user/app/tests/kernel/threads.c index cb7111d..abca41c 100644 --- a/src/user/app/tests/kernel/threads.c +++ b/src/user/app/tests/kernel/threads.c @@ -18,13 +18,13 @@ static void test_basic_thread(void) { test(global_n == 10); } -handle_t global_h; +hid_t global_h; static void shared_handle(void *sem) { - handle_t ends[2]; - test(_syscall_pipe(ends, 0) >= 0); + hid_t ends[2]; + test(_sys_pipe(ends, 0) >= 0); global_h = ends[0]; esem_signal(sem); - _syscall_write(ends[1], "Hello!", 7, -1, 0); + _sys_write(ends[1], "Hello!", 7, -1, 0); } static void test_shared_handle(void) { struct evil_sem *sem = esem_new(0); @@ -34,7 +34,7 @@ static void test_shared_handle(void) { esem_wait(sem); test(global_h >= 0); - test(_syscall_read(global_h, buf, sizeof buf, 0) == 7); + test(_sys_read(global_h, buf, sizeof buf, 0) == 7); test(!strcmp("Hello!", buf)); } @@ -44,7 +44,7 @@ static void many_thread(void *arg) { static void test_many_threads(void) { uint64_t n = 0; for (int i = 0; i < 10; i++) thread_create(0, many_thread, &n); - for (int i = 0; i < 10; i++) _syscall_await(); + for (int i = 0; i < 10; i++) _sys_await(); test(n == 100); } |