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/sys/mman.h | 2 +- userland/libc/sys/mman/mmap.c | 4 ++-- userland/libc/sys/mman/munmap.c | 2 +- userland/libc/sys/sendfile.c | 2 +- userland/libc/sys/socket/listen.c | 6 +++--- userland/libc/sys/socket/sendto.c | 2 +- userland/libc/sys/time/gettimeofday.c | 6 ++++-- userland/libc/sys/types.h | 4 ++-- 8 files changed, 15 insertions(+), 13 deletions(-) (limited to 'userland/libc/sys') diff --git a/userland/libc/sys/mman.h b/userland/libc/sys/mman.h index e3ff734..a915291 100644 --- a/userland/libc/sys/mman.h +++ b/userland/libc/sys/mman.h @@ -1,7 +1,7 @@ #ifndef MMAP_H #define MMAP_H -#include #include +#include void *mmap(void *addr, size_t length, int prot, int flags, int fd, size_t offset); diff --git a/userland/libc/sys/mman/mmap.c b/userland/libc/sys/mman/mmap.c index b9ad3a2..53c6f77 100644 --- a/userland/libc/sys/mman/mmap.c +++ b/userland/libc/sys/mman/mmap.c @@ -1,6 +1,6 @@ -#include #include #include +#include extern int errno; @@ -14,6 +14,6 @@ void *mmap(void *addr, size_t length, int prot, int flags, int fd, .fd = fd, .offset = offset, }; -// return (void*)syscall(SYS_MMAP, &args, 0, 0, 0, 0); + // return (void*)syscall(SYS_MMAP, &args, 0, 0, 0, 0); RC_ERRNO(syscall(SYS_MMAP, &args, 0, 0, 0, 0)); } diff --git a/userland/libc/sys/mman/munmap.c b/userland/libc/sys/mman/munmap.c index 940ea46..5750cb4 100644 --- a/userland/libc/sys/mman/munmap.c +++ b/userland/libc/sys/mman/munmap.c @@ -2,5 +2,5 @@ #include int munmap(void *addr, size_t length) { - RC_ERRNO(syscall(SYS_MUNMAP, addr, length,0, 0, 0)); + RC_ERRNO(syscall(SYS_MUNMAP, addr, length, 0, 0, 0)); } diff --git a/userland/libc/sys/sendfile.c b/userland/libc/sys/sendfile.c index 818883b..9de931b 100644 --- a/userland/libc/sys/sendfile.c +++ b/userland/libc/sys/sendfile.c @@ -1,6 +1,6 @@ +#include #include #include -#include u32 sendfile(int out_fd, int in_fd, off_t *offset, size_t count, int *error_rc) { diff --git a/userland/libc/sys/socket/listen.c b/userland/libc/sys/socket/listen.c index a3bec10..67cc6ce 100644 --- a/userland/libc/sys/socket/listen.c +++ b/userland/libc/sys/socket/listen.c @@ -1,9 +1,9 @@ -#include #include +#include int listen(int socket, int backlog) { - (void)socket; - (void)backlog; + (void)socket; + (void)backlog; printf("TODO: Implement listen()\n"); return 0; } diff --git a/userland/libc/sys/socket/sendto.c b/userland/libc/sys/socket/sendto.c index 73437ab..be35ec0 100644 --- a/userland/libc/sys/socket/sendto.c +++ b/userland/libc/sys/socket/sendto.c @@ -7,7 +7,7 @@ struct two_args { }; size_t sendto(int socket, const void *message, size_t length, int flags, - const struct sockaddr *dest_addr, socklen_t dest_len) { + const struct sockaddr *dest_addr, socklen_t dest_len) { struct two_args extra = { .a = dest_addr, .b = dest_len, diff --git a/userland/libc/sys/time/gettimeofday.c b/userland/libc/sys/time/gettimeofday.c index e172cf2..3487254 100644 --- a/userland/libc/sys/time/gettimeofday.c +++ b/userland/libc/sys/time/gettimeofday.c @@ -1,5 +1,7 @@ #include #include -static int return_tod =0; -int gettimeofday(struct timeval *tp, void *tzp) {return return_tod++;} +static int return_tod = 0; +int gettimeofday(struct timeval *tp, void *tzp) { + return return_tod++; +} diff --git a/userland/libc/sys/types.h b/userland/libc/sys/types.h index ffcf281..d9bede0 100644 --- a/userland/libc/sys/types.h +++ b/userland/libc/sys/types.h @@ -16,12 +16,12 @@ typedef int dev_t; typedef unsigned int fsblkcnt_t; typedef unsigned int fsfilcnt_t; typedef unsigned int ino_t; -//typedef unsigned int size_t; +// typedef unsigned int size_t; typedef int blksize_t; typedef int pid_t; typedef int ssize_t; -//typedef int clock_t; +// typedef int clock_t; typedef int time_t; #endif -- cgit v1.2.3