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/fdlimit.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/fdlimit.c')
-rw-r--r-- | src/user/app/tests/kernel/fdlimit.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/user/app/tests/kernel/fdlimit.c b/src/user/app/tests/kernel/fdlimit.c index d22af13..f332357 100644 --- a/src/user/app/tests/kernel/fdlimit.c +++ b/src/user/app/tests/kernel/fdlimit.c @@ -4,10 +4,10 @@ #include <unistd.h> static void test_fdlimit_pipe(void) { - handle_t ends[2]; - handle_t h[2] = {-1, -1}; + hid_t ends[2]; + hid_t h[2] = {-1, -1}; for (;;) { - handle_t cur = _syscall_open("/", 1, OPEN_READ); + hid_t cur = _sys_open("/", 1, OPEN_READ); if (cur == -EMFILE) break; test(cur >= 0); h[0] = h[1]; @@ -15,31 +15,31 @@ static void test_fdlimit_pipe(void) { } test(h[0] >= 0); /* we need at least two handles */ - test(_syscall_pipe(ends, 0) == -EMFILE); - test(_syscall_open("/", 1, OPEN_READ) == -EMFILE); + test(_sys_pipe(ends, 0) == -EMFILE); + test(_sys_open("/", 1, OPEN_READ) == -EMFILE); close(h[1]); - test(_syscall_pipe(ends, 0) == -EMFILE); - test(_syscall_open("/", 1, OPEN_READ) == h[1]); - test(_syscall_open("/", 1, OPEN_READ) == -EMFILE); + test(_sys_pipe(ends, 0) == -EMFILE); + test(_sys_open("/", 1, OPEN_READ) == h[1]); + test(_sys_open("/", 1, OPEN_READ) == -EMFILE); close(h[0]); close(h[1]); - test(_syscall_pipe(ends, 0) == 0); + test(_sys_pipe(ends, 0) == 0); } static void test_fdlimit_fork(void) { for (;;) { - handle_t cur = _syscall_open("/", 1, OPEN_READ); + hid_t cur = _sys_open("/", 1, OPEN_READ); if (cur == -EMFILE) break; test(cur >= 0); } - if (!_syscall_fork(0, NULL)) _syscall_exit(123); + if (!_sys_fork(0, NULL)) _sys_exit(123); - test(_syscall_fork(FORK_NEWFS, NULL) == -EMFILE); - test(_syscall_await() == 123); - test(_syscall_await() == ~0); + test(_sys_fork(FORK_NEWFS, NULL) == -EMFILE); + test(_sys_await() == 123); + test(_sys_await() == ~0); } void r_k_fdlimit(void) { |