From bb70eef85bbe9c322e1b3d55330bc814918e7331 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Fri, 23 Jan 2015 00:29:04 +0100 Subject: [PATCH] Replace system call array types with pointers. --- kernel/include/sortix/kernel/syscall.h | 10 +++++----- kernel/io.cpp | 6 +++--- kernel/pipe.cpp | 4 ++-- kernel/process.cpp | 10 +++++----- libc/sys/stat/futimens.cpp | 1 - libc/sys/stat/utimensat.cpp | 1 - 6 files changed, 15 insertions(+), 17 deletions(-) diff --git a/kernel/include/sortix/kernel/syscall.h b/kernel/include/sortix/kernel/syscall.h index 09ea6d79..d98545b7 100644 --- a/kernel/include/sortix/kernel/syscall.h +++ b/kernel/include/sortix/kernel/syscall.h @@ -1,6 +1,6 @@ /******************************************************************************* - Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014. + Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014, 2015. This file is part of Sortix. @@ -65,7 +65,7 @@ int sys_dispmsg_issue(void*, size_t); int sys_dup(int); int sys_dup2(int, int); int sys_dup3(int, int, int); -int sys_execve(const char*, char* const [], char* const []); +int sys_execve(const char*, char* const*, char* const*); int sys_exit_thread(int, int, const struct exit_thread*); int sys_faccessat(int, const char*, int, int); int sys_fchdir(int); @@ -85,7 +85,7 @@ int sys_fstatvfs(int, struct statvfs*); int sys_fstatvfsat(int, const char*, struct statvfs*, int); int sys_fsync(int); int sys_ftruncate(int, off_t); -int sys_futimens(int, const struct timespec [2]); +int sys_futimens(int, const struct timespec*); gid_t sys_getegid(void); int sys_getentropy(void*, size_t); uid_t sys_geteuid(void); @@ -116,7 +116,7 @@ void* sys_mmap_wrapper(struct mmap_request*); int sys_mprotect(const void*, size_t, int); int sys_munmap(void*, size_t); int sys_openat(int, const char*, int, mode_t); -int sys_pipe2(int [2], int); +int sys_pipe2(int*, int); int sys_ppoll(struct pollfd*, nfds_t, const struct timespec*, const sigset_t*); ssize_t sys_pread(int, void*, size_t, off_t); ssize_t sys_preadv(int, const struct iovec*, int, off_t); @@ -168,7 +168,7 @@ int sys_truncateat(int, const char*, off_t); mode_t sys_umask(mode_t); int sys_unlinkat(int, const char*, int); int sys_unmountat(int, const char*, int); -int sys_utimensat(int, const char*, const struct timespec [2], int); +int sys_utimensat(int, const char*, const struct timespec*, int); pid_t sys_waitpid(pid_t, int*, int); ssize_t sys_write(int, const void*, size_t); ssize_t sys_writev(int, const struct iovec*, int); diff --git a/kernel/io.cpp b/kernel/io.cpp index 9ed7b76f..3d25c851 100644 --- a/kernel/io.cpp +++ b/kernel/io.cpp @@ -1,6 +1,6 @@ /******************************************************************************* - Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014. + Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014, 2015. This file is part of Sortix. @@ -492,7 +492,7 @@ int sys_fchmodat(int dirfd, const char* path, mode_t mode, int flags) return desc->chmod(&ctx, mode); } -int sys_futimens(int fd, const struct timespec user_times[2]) +int sys_futimens(int fd, const struct timespec* user_times) { struct timespec times[2]; if ( !CopyFromUser(times, user_times, sizeof(times)) ) @@ -505,7 +505,7 @@ int sys_futimens(int fd, const struct timespec user_times[2]) } int sys_utimensat(int dirfd, const char* path, - const struct timespec user_times[2], int flags) + const struct timespec* user_times, int flags) { if ( flags & ~(AT_SYMLINK_NOFOLLOW) ) return errno = EINVAL, -1; diff --git a/kernel/pipe.cpp b/kernel/pipe.cpp index f8a94cb0..6810b747 100644 --- a/kernel/pipe.cpp +++ b/kernel/pipe.cpp @@ -1,6 +1,6 @@ /******************************************************************************* - Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014. + Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014, 2015. This file is part of Sortix. @@ -509,7 +509,7 @@ int PipeNode::poll(ioctx_t* ctx, PollNode* node) return endpoint.poll(ctx, node); } -int sys_pipe2(int pipefd[2], int flags) +int sys_pipe2(int* pipefd, int flags) { int fdflags = 0; if ( flags & O_CLOEXEC ) fdflags |= FD_CLOEXEC; diff --git a/kernel/process.cpp b/kernel/process.cpp index 82bafe3a..94af131c 100644 --- a/kernel/process.cpp +++ b/kernel/process.cpp @@ -1,6 +1,6 @@ /******************************************************************************* - Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014. + Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014, 2015. This file is part of Sortix. @@ -1150,9 +1150,9 @@ static void sys_execve_free(addralloc_t* alloc) static int sys_execve_kernel(const char* filename, int argc, - char* const argv[], + char* const* argv, int envc, - char* const envp[], + char* const* envp, struct thread_registers* regs) { Process* process = CurrentProcess(); @@ -1322,8 +1322,8 @@ int sys_execve_kernel(const char* filename, } int sys_execve(const char* user_filename, - char* const user_argv[], - char* const user_envp[]) + char* const* user_argv, + char* const* user_envp) { char* filename; int argc; diff --git a/libc/sys/stat/futimens.cpp b/libc/sys/stat/futimens.cpp index dae622c7..a9f1f2b0 100644 --- a/libc/sys/stat/futimens.cpp +++ b/libc/sys/stat/futimens.cpp @@ -25,7 +25,6 @@ #include #include -// TODO: You cannot currently pass array types to the DEFN_SYSCALL* family. DEFN_SYSCALL2(int, sys_futimens, SYSCALL_FUTIMENS, int, const struct timespec*); extern "C" int futimens(int fd, const struct timespec times[2]) diff --git a/libc/sys/stat/utimensat.cpp b/libc/sys/stat/utimensat.cpp index 52fd4a1d..ae077b6e 100644 --- a/libc/sys/stat/utimensat.cpp +++ b/libc/sys/stat/utimensat.cpp @@ -27,7 +27,6 @@ #include -// TODO: You cannot currently pass array types to the DEFN_SYSCALL* family. DEFN_SYSCALL4(int, sys_utimensat, SYSCALL_UTIMENSAT, int, const char*, const struct timespec*, int);