From b033314bf1901d436dc71d41d5e1f37dda47e511 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Thu, 12 Dec 2024 16:03:08 +0100 Subject: formatting: Use clang-format on all projects This commit also add braces to all `if` statements. --- userland/libc/unistd/_exit.c | 4 +++- userland/libc/unistd/chdir.c | 6 ++++-- userland/libc/unistd/getpid.c | 6 +++--- userland/libc/unistd/isatty.c | 5 +++-- userland/libc/unistd/msleep.c | 6 ++++-- userland/libc/unistd/unlink.c | 2 +- userland/libc/unistd/uptime.c | 4 +++- userland/libc/unistd/write.c | 2 +- 8 files changed, 22 insertions(+), 13 deletions(-) (limited to 'userland/libc/unistd') diff --git a/userland/libc/unistd/_exit.c b/userland/libc/unistd/_exit.c index c6d64be..a6cc645 100644 --- a/userland/libc/unistd/_exit.c +++ b/userland/libc/unistd/_exit.c @@ -5,4 +5,6 @@ // stackoverflow answer says that it does not usually matter. So lets // hope that is the case. // https://stackoverflow.com/a/5423108 -void _exit(int status) { syscall(SYS_EXIT, (void *)status, 0, 0, 0, 0); } +void _exit(int status) { + syscall(SYS_EXIT, (void *)status, 0, 0, 0, 0); +} diff --git a/userland/libc/unistd/chdir.c b/userland/libc/unistd/chdir.c index 90b30ae..61372c0 100644 --- a/userland/libc/unistd/chdir.c +++ b/userland/libc/unistd/chdir.c @@ -1,4 +1,6 @@ -#include #include +#include -int chdir(const char *path) { RC_ERRNO(syscall(SYS_CHDIR, path, 0, 0, 0, 0)); } +int chdir(const char *path) { + RC_ERRNO(syscall(SYS_CHDIR, path, 0, 0, 0, 0)); +} diff --git a/userland/libc/unistd/getpid.c b/userland/libc/unistd/getpid.c index 8aeef10..47f9e71 100644 --- a/userland/libc/unistd/getpid.c +++ b/userland/libc/unistd/getpid.c @@ -1,7 +1,7 @@ -#include -#include #include +#include +#include pid_t getpid(void) { - return s_syscall(SYS_GETPID); + return s_syscall(SYS_GETPID); } diff --git a/userland/libc/unistd/isatty.c b/userland/libc/unistd/isatty.c index d8b08c3..55cf4e7 100644 --- a/userland/libc/unistd/isatty.c +++ b/userland/libc/unistd/isatty.c @@ -1,11 +1,12 @@ +#include #include #include -#include int isatty(int fd) { int rc = syscall(SYS_ISATTY, fd, 0, 0, 0, 0); - if (1 == rc) + if (1 == rc) { return rc; + } errno = -rc; return 0; } diff --git a/userland/libc/unistd/msleep.c b/userland/libc/unistd/msleep.c index 0b016c6..1f70a7b 100644 --- a/userland/libc/unistd/msleep.c +++ b/userland/libc/unistd/msleep.c @@ -1,6 +1,8 @@ // Not standard, but it feels like it should be. +#include #include #include -#include -void msleep(uint32_t ms) { syscall(SYS_MSLEEP, (void *)ms, 0, 0, 0, 0); } +void msleep(uint32_t ms) { + syscall(SYS_MSLEEP, (void *)ms, 0, 0, 0, 0); +} diff --git a/userland/libc/unistd/unlink.c b/userland/libc/unistd/unlink.c index 7d7aa1c..f26539a 100644 --- a/userland/libc/unistd/unlink.c +++ b/userland/libc/unistd/unlink.c @@ -1,5 +1,5 @@ -#include #include +#include int unlink(const char *path) { // TODO diff --git a/userland/libc/unistd/uptime.c b/userland/libc/unistd/uptime.c index 090a0e5..5a0654f 100644 --- a/userland/libc/unistd/uptime.c +++ b/userland/libc/unistd/uptime.c @@ -3,4 +3,6 @@ #include #include -uint32_t uptime(void) { return syscall(SYS_UPTIME, 0, 0, 0, 0, 0); } +uint32_t uptime(void) { + return syscall(SYS_UPTIME, 0, 0, 0, 0, 0); +} diff --git a/userland/libc/unistd/write.c b/userland/libc/unistd/write.c index 0dd1824..82e29fd 100644 --- a/userland/libc/unistd/write.c +++ b/userland/libc/unistd/write.c @@ -1,6 +1,6 @@ +#include #include #include -#include int write(int fd, const char *buf, size_t count) { RC_ERRNO(syscall(SYS_WRITE, fd, buf, count, 0, 0)); -- cgit v1.2.3