diff options
71 files changed, 313 insertions, 301 deletions
diff --git a/Kernel/Process.h b/Kernel/Process.h index 309da0abf0..8359ed0171 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -263,158 +263,158 @@ public: void stop_tracing(); void tracer_trap(Thread&, const RegisterState&); - KResultOr<int> sys$emuctl(); - KResultOr<int> sys$yield(); - KResultOr<int> sys$sync(); - KResultOr<int> sys$beep(); - KResultOr<int> sys$get_process_name(Userspace<char*> buffer, size_t buffer_size); - KResultOr<int> sys$set_process_name(Userspace<const char*> user_name, size_t user_name_length); - KResultOr<int> sys$create_inode_watcher(u32 flags); - KResultOr<int> sys$inode_watcher_add_watch(Userspace<const Syscall::SC_inode_watcher_add_watch_params*> user_params); - KResultOr<int> sys$inode_watcher_remove_watch(int fd, int wd); - KResultOr<int> sys$dbgputch(u8); - KResultOr<size_t> sys$dbgputstr(Userspace<const u8*>, size_t); - KResultOr<int> sys$dump_backtrace(); - KResultOr<pid_t> sys$gettid(); - KResultOr<int> sys$donate(pid_t tid); - KResultOr<pid_t> sys$setsid(); - KResultOr<pid_t> sys$getsid(pid_t); - KResultOr<int> sys$setpgid(pid_t pid, pid_t pgid); - KResultOr<pid_t> sys$getpgrp(); - KResultOr<pid_t> sys$getpgid(pid_t); - KResultOr<uid_t> sys$getuid(); - KResultOr<gid_t> sys$getgid(); - KResultOr<uid_t> sys$geteuid(); - KResultOr<gid_t> sys$getegid(); - KResultOr<pid_t> sys$getpid(); - KResultOr<pid_t> sys$getppid(); - KResultOr<int> sys$getresuid(Userspace<uid_t*>, Userspace<uid_t*>, Userspace<uid_t*>); - KResultOr<int> sys$getresgid(Userspace<gid_t*>, Userspace<gid_t*>, Userspace<gid_t*>); - KResultOr<mode_t> sys$umask(mode_t); - KResultOr<int> sys$open(Userspace<const Syscall::SC_open_params*>); - KResultOr<int> sys$close(int fd); - KResultOr<size_t> sys$read(int fd, Userspace<u8*>, size_t); - KResultOr<size_t> sys$readv(int fd, Userspace<const struct iovec*> iov, int iov_count); - KResultOr<size_t> sys$write(int fd, Userspace<const u8*>, size_t); - KResultOr<size_t> sys$writev(int fd, Userspace<const struct iovec*> iov, int iov_count); - KResultOr<int> sys$fstat(int fd, Userspace<stat*>); - KResultOr<int> sys$stat(Userspace<const Syscall::SC_stat_params*>); - KResultOr<int> sys$lseek(int fd, Userspace<off_t*>, int whence); - KResultOr<int> sys$ftruncate(int fd, Userspace<off_t*>); - KResultOr<int> sys$kill(pid_t pid_or_pgid, int sig); + KResultOr<FlatPtr> sys$emuctl(); + KResultOr<FlatPtr> sys$yield(); + KResultOr<FlatPtr> sys$sync(); + KResultOr<FlatPtr> sys$beep(); + KResultOr<FlatPtr> sys$get_process_name(Userspace<char*> buffer, size_t buffer_size); + KResultOr<FlatPtr> sys$set_process_name(Userspace<const char*> user_name, size_t user_name_length); + KResultOr<FlatPtr> sys$create_inode_watcher(u32 flags); + KResultOr<FlatPtr> sys$inode_watcher_add_watch(Userspace<const Syscall::SC_inode_watcher_add_watch_params*> user_params); + KResultOr<FlatPtr> sys$inode_watcher_remove_watch(int fd, int wd); + KResultOr<FlatPtr> sys$dbgputch(u8); + KResultOr<FlatPtr> sys$dbgputstr(Userspace<const u8*>, size_t); + KResultOr<FlatPtr> sys$dump_backtrace(); + KResultOr<FlatPtr> sys$gettid(); + KResultOr<FlatPtr> sys$donate(pid_t tid); + KResultOr<FlatPtr> sys$setsid(); + KResultOr<FlatPtr> sys$getsid(pid_t); + KResultOr<FlatPtr> sys$setpgid(pid_t pid, pid_t pgid); + KResultOr<FlatPtr> sys$getpgrp(); + KResultOr<FlatPtr> sys$getpgid(pid_t); + KResultOr<FlatPtr> sys$getuid(); + KResultOr<FlatPtr> sys$getgid(); + KResultOr<FlatPtr> sys$geteuid(); + KResultOr<FlatPtr> sys$getegid(); + KResultOr<FlatPtr> sys$getpid(); + KResultOr<FlatPtr> sys$getppid(); + KResultOr<FlatPtr> sys$getresuid(Userspace<uid_t*>, Userspace<uid_t*>, Userspace<uid_t*>); + KResultOr<FlatPtr> sys$getresgid(Userspace<gid_t*>, Userspace<gid_t*>, Userspace<gid_t*>); + KResultOr<FlatPtr> sys$umask(mode_t); + KResultOr<FlatPtr> sys$open(Userspace<const Syscall::SC_open_params*>); + KResultOr<FlatPtr> sys$close(int fd); + KResultOr<FlatPtr> sys$read(int fd, Userspace<u8*>, size_t); + KResultOr<FlatPtr> sys$readv(int fd, Userspace<const struct iovec*> iov, int iov_count); + KResultOr<FlatPtr> sys$write(int fd, Userspace<const u8*>, size_t); + KResultOr<FlatPtr> sys$writev(int fd, Userspace<const struct iovec*> iov, int iov_count); + KResultOr<FlatPtr> sys$fstat(int fd, Userspace<stat*>); + KResultOr<FlatPtr> sys$stat(Userspace<const Syscall::SC_stat_params*>); + KResultOr<FlatPtr> sys$lseek(int fd, Userspace<off_t*>, int whence); + KResultOr<FlatPtr> sys$ftruncate(int fd, Userspace<off_t*>); + KResultOr<FlatPtr> sys$kill(pid_t pid_or_pgid, int sig); [[noreturn]] void sys$exit(int status); - KResultOr<int> sys$sigreturn(RegisterState& registers); - KResultOr<pid_t> sys$waitid(Userspace<const Syscall::SC_waitid_params*>); + KResultOr<FlatPtr> sys$sigreturn(RegisterState& registers); + KResultOr<FlatPtr> sys$waitid(Userspace<const Syscall::SC_waitid_params*>); KResultOr<FlatPtr> sys$mmap(Userspace<const Syscall::SC_mmap_params*>); KResultOr<FlatPtr> sys$mremap(Userspace<const Syscall::SC_mremap_params*>); - KResultOr<int> sys$munmap(Userspace<void*>, size_t); - KResultOr<int> sys$set_mmap_name(Userspace<const Syscall::SC_set_mmap_name_params*>); - KResultOr<int> sys$mprotect(Userspace<void*>, size_t, int prot); - KResultOr<int> sys$madvise(Userspace<void*>, size_t, int advice); - KResultOr<int> sys$msyscall(Userspace<void*>); - KResultOr<int> sys$purge(int mode); - KResultOr<int> sys$select(Userspace<const Syscall::SC_select_params*>); - KResultOr<int> sys$poll(Userspace<const Syscall::SC_poll_params*>); - KResultOr<size_t> sys$get_dir_entries(int fd, Userspace<void*>, size_t); - KResultOr<int> sys$getcwd(Userspace<char*>, size_t); - KResultOr<int> sys$chdir(Userspace<const char*>, size_t); - KResultOr<int> sys$fchdir(int fd); - KResultOr<int> sys$adjtime(Userspace<const timeval*>, Userspace<timeval*>); - KResultOr<int> sys$gettimeofday(Userspace<timeval*>); - KResultOr<int> sys$clock_gettime(clockid_t, Userspace<timespec*>); - KResultOr<int> sys$clock_settime(clockid_t, Userspace<const timespec*>); - KResultOr<int> sys$clock_nanosleep(Userspace<const Syscall::SC_clock_nanosleep_params*>); - KResultOr<int> sys$gethostname(Userspace<char*>, size_t); - KResultOr<int> sys$sethostname(Userspace<const char*>, size_t); - KResultOr<int> sys$uname(Userspace<utsname*>); - KResultOr<int> sys$readlink(Userspace<const Syscall::SC_readlink_params*>); - KResultOr<int> sys$ttyname(int fd, Userspace<char*>, size_t); - KResultOr<int> sys$ptsname(int fd, Userspace<char*>, size_t); - KResultOr<pid_t> sys$fork(RegisterState&); - KResultOr<int> sys$execve(Userspace<const Syscall::SC_execve_params*>); - KResultOr<int> sys$dup2(int old_fd, int new_fd); - KResultOr<int> sys$sigaction(int signum, Userspace<const sigaction*> act, Userspace<sigaction*> old_act); - KResultOr<int> sys$sigprocmask(int how, Userspace<const sigset_t*> set, Userspace<sigset_t*> old_set); - KResultOr<int> sys$sigpending(Userspace<sigset_t*>); - KResultOr<int> sys$getgroups(size_t, Userspace<gid_t*>); - KResultOr<int> sys$setgroups(size_t, Userspace<const gid_t*>); - KResultOr<int> sys$pipe(int pipefd[2], int flags); - KResultOr<int> sys$killpg(pid_t pgrp, int sig); - KResultOr<int> sys$seteuid(uid_t); - KResultOr<int> sys$setegid(gid_t); - KResultOr<int> sys$setuid(uid_t); - KResultOr<int> sys$setgid(gid_t); - KResultOr<int> sys$setreuid(uid_t, uid_t); - KResultOr<int> sys$setresuid(uid_t, uid_t, uid_t); - KResultOr<int> sys$setresgid(gid_t, gid_t, gid_t); - KResultOr<unsigned> sys$alarm(unsigned seconds); - KResultOr<int> sys$access(Userspace<const char*> pathname, size_t path_length, int mode); - KResultOr<int> sys$fcntl(int fd, int cmd, u32 extra_arg); - KResultOr<int> sys$ioctl(int fd, unsigned request, FlatPtr arg); - KResultOr<int> sys$mkdir(Userspace<const char*> pathname, size_t path_length, mode_t mode); - KResultOr<clock_t> sys$times(Userspace<tms*>); - KResultOr<int> sys$utime(Userspace<const char*> pathname, size_t path_length, Userspace<const struct utimbuf*>); - KResultOr<int> sys$link(Userspace<const Syscall::SC_link_params*>); - KResultOr<int> sys$unlink(Userspace<const char*> pathname, size_t path_length); - KResultOr<int> sys$symlink(Userspace<const Syscall::SC_symlink_params*>); - KResultOr<int> sys$rmdir(Userspace<const char*> pathname, size_t path_length); - KResultOr<int> sys$mount(Userspace<const Syscall::SC_mount_params*>); - KResultOr<int> sys$umount(Userspace<const char*> mountpoint, size_t mountpoint_length); - KResultOr<int> sys$chmod(Userspace<const char*> pathname, size_t path_length, mode_t); - KResultOr<int> sys$fchmod(int fd, mode_t); - KResultOr<int> sys$chown(Userspace<const Syscall::SC_chown_params*>); - KResultOr<int> sys$fchown(int fd, uid_t, gid_t); - KResultOr<int> sys$socket(int domain, int type, int protocol); - KResultOr<int> sys$bind(int sockfd, Userspace<const sockaddr*> addr, socklen_t); - KResultOr<int> sys$listen(int sockfd, int backlog); - KResultOr<int> sys$accept4(Userspace<const Syscall::SC_accept4_params*>); - KResultOr<int> sys$connect(int sockfd, Userspace<const sockaddr*>, socklen_t); - KResultOr<int> sys$shutdown(int sockfd, int how); - KResultOr<size_t> sys$sendmsg(int sockfd, Userspace<const struct msghdr*>, int flags); - KResultOr<size_t> sys$recvmsg(int sockfd, Userspace<struct msghdr*>, int flags); - KResultOr<int> sys$getsockopt(Userspace<const Syscall::SC_getsockopt_params*>); - KResultOr<int> sys$setsockopt(Userspace<const Syscall::SC_setsockopt_params*>); - KResultOr<int> sys$getsockname(Userspace<const Syscall::SC_getsockname_params*>); - KResultOr<int> sys$getpeername(Userspace<const Syscall::SC_getpeername_params*>); - KResultOr<int> sys$socketpair(Userspace<const Syscall::SC_socketpair_params*>); - KResultOr<int> sys$sched_setparam(pid_t pid, Userspace<const struct sched_param*>); - KResultOr<int> sys$sched_getparam(pid_t pid, Userspace<struct sched_param*>); - KResultOr<int> sys$create_thread(void* (*)(void*), Userspace<const Syscall::SC_create_thread_params*>); + KResultOr<FlatPtr> sys$munmap(Userspace<void*>, size_t); + KResultOr<FlatPtr> sys$set_mmap_name(Userspace<const Syscall::SC_set_mmap_name_params*>); + KResultOr<FlatPtr> sys$mprotect(Userspace<void*>, size_t, int prot); + KResultOr<FlatPtr> sys$madvise(Userspace<void*>, size_t, int advice); + KResultOr<FlatPtr> sys$msyscall(Userspace<void*>); + KResultOr<FlatPtr> sys$purge(int mode); + KResultOr<FlatPtr> sys$select(Userspace<const Syscall::SC_select_params*>); + KResultOr<FlatPtr> sys$poll(Userspace<const Syscall::SC_poll_params*>); + KResultOr<FlatPtr> sys$get_dir_entries(int fd, Userspace<void*>, size_t); + KResultOr<FlatPtr> sys$getcwd(Userspace<char*>, size_t); + KResultOr<FlatPtr> sys$chdir(Userspace<const char*>, size_t); + KResultOr<FlatPtr> sys$fchdir(int fd); + KResultOr<FlatPtr> sys$adjtime(Userspace<const timeval*>, Userspace<timeval*>); + KResultOr<FlatPtr> sys$gettimeofday(Userspace<timeval*>); + KResultOr<FlatPtr> sys$clock_gettime(clockid_t, Userspace<timespec*>); + KResultOr<FlatPtr> sys$clock_settime(clockid_t, Userspace<const timespec*>); + KResultOr<FlatPtr> sys$clock_nanosleep(Userspace<const Syscall::SC_clock_nanosleep_params*>); + KResultOr<FlatPtr> sys$gethostname(Userspace<char*>, size_t); + KResultOr<FlatPtr> sys$sethostname(Userspace<const char*>, size_t); + KResultOr<FlatPtr> sys$uname(Userspace<utsname*>); + KResultOr<FlatPtr> sys$readlink(Userspace<const Syscall::SC_readlink_params*>); + KResultOr<FlatPtr> sys$ttyname(int fd, Userspace<char*>, size_t); + KResultOr<FlatPtr> sys$ptsname(int fd, Userspace<char*>, size_t); + KResultOr<FlatPtr> sys$fork(RegisterState&); + KResultOr<FlatPtr> sys$execve(Userspace<const Syscall::SC_execve_params*>); + KResultOr<FlatPtr> sys$dup2(int old_fd, int new_fd); + KResultOr<FlatPtr> sys$sigaction(int signum, Userspace<const sigaction*> act, Userspace<sigaction*> old_act); + KResultOr<FlatPtr> sys$sigprocmask(int how, Userspace<const sigset_t*> set, Userspace<sigset_t*> old_set); + KResultOr<FlatPtr> sys$sigpending(Userspace<sigset_t*>); + KResultOr<FlatPtr> sys$getgroups(size_t, Userspace<gid_t*>); + KResultOr<FlatPtr> sys$setgroups(size_t, Userspace<const gid_t*>); + KResultOr<FlatPtr> sys$pipe(int pipefd[2], int flags); + KResultOr<FlatPtr> sys$killpg(pid_t pgrp, int sig); + KResultOr<FlatPtr> sys$seteuid(uid_t); + KResultOr<FlatPtr> sys$setegid(gid_t); + KResultOr<FlatPtr> sys$setuid(uid_t); + KResultOr<FlatPtr> sys$setgid(gid_t); + KResultOr<FlatPtr> sys$setreuid(uid_t, uid_t); + KResultOr<FlatPtr> sys$setresuid(uid_t, uid_t, uid_t); + KResultOr<FlatPtr> sys$setresgid(gid_t, gid_t, gid_t); + KResultOr<FlatPtr> sys$alarm(unsigned seconds); + KResultOr<FlatPtr> sys$access(Userspace<const char*> pathname, size_t path_length, int mode); + KResultOr<FlatPtr> sys$fcntl(int fd, int cmd, u32 extra_arg); + KResultOr<FlatPtr> sys$ioctl(int fd, unsigned request, FlatPtr arg); + KResultOr<FlatPtr> sys$mkdir(Userspace<const char*> pathname, size_t path_length, mode_t mode); + KResultOr<FlatPtr> sys$times(Userspace<tms*>); + KResultOr<FlatPtr> sys$utime(Userspace<const char*> pathname, size_t path_length, Userspace<const struct utimbuf*>); + KResultOr<FlatPtr> sys$link(Userspace<const Syscall::SC_link_params*>); + KResultOr<FlatPtr> sys$unlink(Userspace<const char*> pathname, size_t path_length); + KResultOr<FlatPtr> sys$symlink(Userspace<const Syscall::SC_symlink_params*>); + KResultOr<FlatPtr> sys$rmdir(Userspace<const char*> pathname, size_t path_length); + KResultOr<FlatPtr> sys$mount(Userspace<const Syscall::SC_mount_params*>); + KResultOr<FlatPtr> sys$umount(Userspace<const char*> mountpoint, size_t mountpoint_length); + KResultOr<FlatPtr> sys$chmod(Userspace<const char*> pathname, size_t path_length, mode_t); + KResultOr<FlatPtr> sys$fchmod(int fd, mode_t); + KResultOr<FlatPtr> sys$chown(Userspace<const Syscall::SC_chown_params*>); + KResultOr<FlatPtr> sys$fchown(int fd, uid_t, gid_t); + KResultOr<FlatPtr> sys$socket(int domain, int type, int protocol); + KResultOr<FlatPtr> sys$bind(int sockfd, Userspace<const sockaddr*> addr, socklen_t); + KResultOr<FlatPtr> sys$listen(int sockfd, int backlog); + KResultOr<FlatPtr> sys$accept4(Userspace<const Syscall::SC_accept4_params*>); + KResultOr<FlatPtr> sys$connect(int sockfd, Userspace<const sockaddr*>, socklen_t); + KResultOr<FlatPtr> sys$shutdown(int sockfd, int how); + KResultOr<FlatPtr> sys$sendmsg(int sockfd, Userspace<const struct msghdr*>, int flags); + KResultOr<FlatPtr> sys$recvmsg(int sockfd, Userspace<struct msghdr*>, int flags); + KResultOr<FlatPtr> sys$getsockopt(Userspace<const Syscall::SC_getsockopt_params*>); + KResultOr<FlatPtr> sys$setsockopt(Userspace<const Syscall::SC_setsockopt_params*>); + KResultOr<FlatPtr> sys$getsockname(Userspace<const Syscall::SC_getsockname_params*>); + KResultOr<FlatPtr> sys$getpeername(Userspace<const Syscall::SC_getpeername_params*>); + KResultOr<FlatPtr> sys$socketpair(Userspace<const Syscall::SC_socketpair_params*>); + KResultOr<FlatPtr> sys$sched_setparam(pid_t pid, Userspace<const struct sched_param*>); + KResultOr<FlatPtr> sys$sched_getparam(pid_t pid, Userspace<struct sched_param*>); + KResultOr<FlatPtr> sys$create_thread(void* (*)(void*), Userspace<const Syscall::SC_create_thread_params*>); [[noreturn]] void sys$exit_thread(Userspace<void*>, Userspace<void*>, size_t); - KResultOr<int> sys$join_thread(pid_t tid, Userspace<void**> exit_value); - KResultOr<int> sys$detach_thread(pid_t tid); - KResultOr<int> sys$set_thread_name(pid_t tid, Userspace<const char*> buffer, size_t buffer_size); - KResultOr<int> sys$get_thread_name(pid_t tid, Userspace<char*> buffer, size_t buffer_size); - KResultOr<int> sys$rename(Userspace<const Syscall::SC_rename_params*>); - KResultOr<int> sys$mknod(Userspace<const Syscall::SC_mknod_params*>); - KResultOr<int> sys$halt(); - KResultOr<int> sys$reboot(); - KResultOr<int> sys$realpath(Userspace<const Syscall::SC_realpath_params*>); - KResultOr<size_t> sys$getrandom(Userspace<void*>, size_t, unsigned int); - KResultOr<int> sys$getkeymap(Userspace<const Syscall::SC_getkeymap_params*>); - KResultOr<int> sys$setkeymap(Userspace<const Syscall::SC_setkeymap_params*>); - KResultOr<int> sys$module_load(Userspace<const char*> path, size_t path_length); - KResultOr<int> sys$module_unload(Userspace<const char*> name, size_t name_length); - KResultOr<int> sys$profiling_enable(pid_t, u64); - KResultOr<int> sys$profiling_disable(pid_t); - KResultOr<int> sys$profiling_free_buffer(pid_t); - KResultOr<int> sys$futex(Userspace<const Syscall::SC_futex_params*>); - KResultOr<int> sys$chroot(Userspace<const char*> path, size_t path_length, int mount_flags); - KResultOr<int> sys$pledge(Userspace<const Syscall::SC_pledge_params*>); - KResultOr<int> sys$unveil(Userspace<const Syscall::SC_unveil_params*>); - KResultOr<int> sys$perf_event(int type, FlatPtr arg1, FlatPtr arg2); - KResultOr<int> sys$get_stack_bounds(Userspace<FlatPtr*> stack_base, Userspace<size_t*> stack_size); - KResultOr<int> sys$ptrace(Userspace<const Syscall::SC_ptrace_params*>); - KResultOr<int> sys$sendfd(int sockfd, int fd); - KResultOr<int> sys$recvfd(int sockfd, int options); - KResultOr<long> sys$sysconf(int name); - KResultOr<int> sys$disown(ProcessID); + KResultOr<FlatPtr> sys$join_thread(pid_t tid, Userspace<void**> exit_value); + KResultOr<FlatPtr> sys$detach_thread(pid_t tid); + KResultOr<FlatPtr> sys$set_thread_name(pid_t tid, Userspace<const char*> buffer, size_t buffer_size); + KResultOr<FlatPtr> sys$get_thread_name(pid_t tid, Userspace<char*> buffer, size_t buffer_size); + KResultOr<FlatPtr> sys$rename(Userspace<const Syscall::SC_rename_params*>); + KResultOr<FlatPtr> sys$mknod(Userspace<const Syscall::SC_mknod_params*>); + KResultOr<FlatPtr> sys$halt(); + KResultOr<FlatPtr> sys$reboot(); + KResultOr<FlatPtr> sys$realpath(Userspace<const Syscall::SC_realpath_params*>); + KResultOr<FlatPtr> sys$getrandom(Userspace<void*>, size_t, unsigned int); + KResultOr<FlatPtr> sys$getkeymap(Userspace<const Syscall::SC_getkeymap_params*>); + KResultOr<FlatPtr> sys$setkeymap(Userspace<const Syscall::SC_setkeymap_params*>); + KResultOr<FlatPtr> sys$module_load(Userspace<const char*> path, size_t path_length); + KResultOr<FlatPtr> sys$module_unload(Userspace<const char*> name, size_t name_length); + KResultOr<FlatPtr> sys$profiling_enable(pid_t, u64); + KResultOr<FlatPtr> sys$profiling_disable(pid_t); + KResultOr<FlatPtr> sys$profiling_free_buffer(pid_t); + KResultOr<FlatPtr> sys$futex(Userspace<const Syscall::SC_futex_params*>); + KResultOr<FlatPtr> sys$chroot(Userspace<const char*> path, size_t path_length, int mount_flags); + KResultOr<FlatPtr> sys$pledge(Userspace<const Syscall::SC_pledge_params*>); + KResultOr<FlatPtr> sys$unveil(Userspace<const Syscall::SC_unveil_params*>); + KResultOr<FlatPtr> sys$perf_event(int type, FlatPtr arg1, FlatPtr arg2); + KResultOr<FlatPtr> sys$get_stack_bounds(Userspace<FlatPtr*> stack_base, Userspace<size_t*> stack_size); + KResultOr<FlatPtr> sys$ptrace(Userspace<const Syscall::SC_ptrace_params*>); + KResultOr<FlatPtr> sys$sendfd(int sockfd, int fd); + KResultOr<FlatPtr> sys$recvfd(int sockfd, int options); + KResultOr<FlatPtr> sys$sysconf(int name); + KResultOr<FlatPtr> sys$disown(ProcessID); KResultOr<FlatPtr> sys$allocate_tls(Userspace<const char*> initial_data, size_t); - KResultOr<int> sys$prctl(int option, FlatPtr arg1, FlatPtr arg2); - KResultOr<int> sys$set_coredump_metadata(Userspace<const Syscall::SC_set_coredump_metadata_params*>); - KResultOr<int> sys$anon_create(size_t, int options); - KResultOr<int> sys$statvfs(Userspace<const Syscall::SC_statvfs_params*> user_params); - KResultOr<int> sys$fstatvfs(int fd, statvfs* buf); + KResultOr<FlatPtr> sys$prctl(int option, FlatPtr arg1, FlatPtr arg2); + KResultOr<FlatPtr> sys$set_coredump_metadata(Userspace<const Syscall::SC_set_coredump_metadata_params*>); + KResultOr<FlatPtr> sys$anon_create(size_t, int options); + KResultOr<FlatPtr> sys$statvfs(Userspace<const Syscall::SC_statvfs_params*> user_params); + KResultOr<FlatPtr> sys$fstatvfs(int fd, statvfs* buf); template<bool sockname, typename Params> int get_sock_or_peer_name(const Params&); @@ -532,9 +532,9 @@ private: void delete_perf_events_buffer(); KResult do_exec(NonnullRefPtr<FileDescription> main_program_description, Vector<String> arguments, Vector<String> environment, RefPtr<FileDescription> interpreter_description, Thread*& new_main_thread, u32& prev_flags, const ElfW(Ehdr) & main_program_header); - KResultOr<size_t> do_write(FileDescription&, const UserOrKernelBuffer&, size_t); + KResultOr<FlatPtr> do_write(FileDescription&, const UserOrKernelBuffer&, size_t); - KResultOr<int> do_statvfs(String path, statvfs* buf); + KResultOr<FlatPtr> do_statvfs(String path, statvfs* buf); KResultOr<RefPtr<FileDescription>> find_elf_interpreter_for_executable(const String& path, const ElfW(Ehdr) & elf_header, int nread, size_t file_size); diff --git a/Kernel/Syscalls/access.cpp b/Kernel/Syscalls/access.cpp index 98d240b632..55b39dd1d8 100644 --- a/Kernel/Syscalls/access.cpp +++ b/Kernel/Syscalls/access.cpp @@ -10,7 +10,7 @@ namespace Kernel { -KResultOr<int> Process::sys$access(Userspace<const char*> user_path, size_t path_length, int mode) +KResultOr<FlatPtr> Process::sys$access(Userspace<const char*> user_path, size_t path_length, int mode) { REQUIRE_PROMISE(rpath); auto path = get_syscall_path_argument(user_path, path_length); diff --git a/Kernel/Syscalls/alarm.cpp b/Kernel/Syscalls/alarm.cpp index 0b8ce36440..1312b78061 100644 --- a/Kernel/Syscalls/alarm.cpp +++ b/Kernel/Syscalls/alarm.cpp @@ -9,7 +9,7 @@ namespace Kernel { -KResultOr<unsigned> Process::sys$alarm(unsigned seconds) +KResultOr<FlatPtr> Process::sys$alarm(unsigned seconds) { REQUIRE_PROMISE(stdio); unsigned previous_alarm_remaining = 0; diff --git a/Kernel/Syscalls/anon_create.cpp b/Kernel/Syscalls/anon_create.cpp index 8f8aa413e1..a7d56bad53 100644 --- a/Kernel/Syscalls/anon_create.cpp +++ b/Kernel/Syscalls/anon_create.cpp @@ -11,7 +11,7 @@ namespace Kernel { -KResultOr<int> Process::sys$anon_create(size_t size, int options) +KResultOr<FlatPtr> Process::sys$anon_create(size_t size, int options) { REQUIRE_PROMISE(stdio); diff --git a/Kernel/Syscalls/beep.cpp b/Kernel/Syscalls/beep.cpp index 8d4accad33..337f61fa97 100644 --- a/Kernel/Syscalls/beep.cpp +++ b/Kernel/Syscalls/beep.cpp @@ -9,7 +9,7 @@ namespace Kernel { -KResultOr<int> Process::sys$beep() +KResultOr<FlatPtr> Process::sys$beep() { PCSpeaker::tone_on(440); auto result = Thread::current()->sleep(Time::from_nanoseconds(200'000'000)); diff --git a/Kernel/Syscalls/chdir.cpp b/Kernel/Syscalls/chdir.cpp index bded5a93fb..715cb94c97 100644 --- a/Kernel/Syscalls/chdir.cpp +++ b/Kernel/Syscalls/chdir.cpp @@ -11,7 +11,7 @@ namespace Kernel { -KResultOr<int> Process::sys$chdir(Userspace<const char*> user_path, size_t path_length) +KResultOr<FlatPtr> Process::sys$chdir(Userspace<const char*> user_path, size_t path_length) { REQUIRE_PROMISE(rpath); auto path = get_syscall_path_argument(user_path, path_length); @@ -24,7 +24,7 @@ KResultOr<int> Process::sys$chdir(Userspace<const char*> user_path, size_t path_ return 0; } -KResultOr<int> Process::sys$fchdir(int fd) +KResultOr<FlatPtr> Process::sys$fchdir(int fd) { REQUIRE_PROMISE(stdio); auto description = file_description(fd); @@ -41,7 +41,7 @@ KResultOr<int> Process::sys$fchdir(int fd) return 0; } -KResultOr<int> Process::sys$getcwd(Userspace<char*> buffer, size_t size) +KResultOr<FlatPtr> Process::sys$getcwd(Userspace<char*> buffer, size_t size) { REQUIRE_PROMISE(rpath); diff --git a/Kernel/Syscalls/chmod.cpp b/Kernel/Syscalls/chmod.cpp index eb352c5fbd..366fb0f0cc 100644 --- a/Kernel/Syscalls/chmod.cpp +++ b/Kernel/Syscalls/chmod.cpp @@ -11,7 +11,7 @@ namespace Kernel { -KResultOr<int> Process::sys$chmod(Userspace<const char*> user_path, size_t path_length, mode_t mode) +KResultOr<FlatPtr> Process::sys$chmod(Userspace<const char*> user_path, size_t path_length, mode_t mode) { REQUIRE_PROMISE(fattr); auto path = get_syscall_path_argument(user_path, path_length); @@ -20,7 +20,7 @@ KResultOr<int> Process::sys$chmod(Userspace<const char*> user_path, size_t path_ return VFS::the().chmod(path.value()->view(), mode, current_directory()); } -KResultOr<int> Process::sys$fchmod(int fd, mode_t mode) +KResultOr<FlatPtr> Process::sys$fchmod(int fd, mode_t mode) { REQUIRE_PROMISE(fattr); auto description = file_description(fd); diff --git a/Kernel/Syscalls/chown.cpp b/Kernel/Syscalls/chown.cpp index bfb50a666a..97d9e50e67 100644 --- a/Kernel/Syscalls/chown.cpp +++ b/Kernel/Syscalls/chown.cpp @@ -9,7 +9,7 @@ namespace Kernel { -KResultOr<int> Process::sys$fchown(int fd, uid_t uid, gid_t gid) +KResultOr<FlatPtr> Process::sys$fchown(int fd, uid_t uid, gid_t gid) { REQUIRE_PROMISE(chown); auto description = file_description(fd); @@ -18,7 +18,7 @@ KResultOr<int> Process::sys$fchown(int fd, uid_t uid, gid_t gid) return description->chown(uid, gid); } -KResultOr<int> Process::sys$chown(Userspace<const Syscall::SC_chown_params*> user_params) +KResultOr<FlatPtr> Process::sys$chown(Userspace<const Syscall::SC_chown_params*> user_params) { REQUIRE_PROMISE(chown); Syscall::SC_chown_params params; diff --git a/Kernel/Syscalls/chroot.cpp b/Kernel/Syscalls/chroot.cpp index 3313e86020..cade89cee3 100644 --- a/Kernel/Syscalls/chroot.cpp +++ b/Kernel/Syscalls/chroot.cpp @@ -11,7 +11,7 @@ namespace Kernel { -KResultOr<int> Process::sys$chroot(Userspace<const char*> user_path, size_t path_length, int mount_flags) +KResultOr<FlatPtr> Process::sys$chroot(Userspace<const char*> user_path, size_t path_length, int mount_flags) { if (!is_superuser()) return EPERM; diff --git a/Kernel/Syscalls/clock.cpp b/Kernel/Syscalls/clock.cpp index a1bdac9bd6..ab20e666f0 100644 --- a/Kernel/Syscalls/clock.cpp +++ b/Kernel/Syscalls/clock.cpp @@ -10,7 +10,7 @@ namespace Kernel { -KResultOr<int> Process::sys$clock_gettime(clockid_t clock_id, Userspace<timespec*> user_ts) +KResultOr<FlatPtr> Process::sys$clock_gettime(clockid_t clock_id, Userspace<timespec*> user_ts) { REQUIRE_PROMISE(stdio); @@ -24,7 +24,7 @@ KResultOr<int> Process::sys$clock_gettime(clockid_t clock_id, Userspace<timespec return 0; } -KResultOr<int> Process::sys$clock_settime(clockid_t clock_id, Userspace<const timespec*> user_ts) +KResultOr<FlatPtr> Process::sys$clock_settime(clockid_t clock_id, Userspace<const timespec*> user_ts) { REQUIRE_PROMISE(settime); @@ -45,7 +45,7 @@ KResultOr<int> Process::sys$clock_settime(clockid_t clock_id, Userspace<const ti return 0; } -KResultOr<int> Process::sys$clock_nanosleep(Userspace<const Syscall::SC_clock_nanosleep_params*> user_params) +KResultOr<FlatPtr> Process::sys$clock_nanosleep(Userspace<const Syscall::SC_clock_nanosleep_params*> user_params) { REQUIRE_PROMISE(stdio); @@ -87,7 +87,7 @@ KResultOr<int> Process::sys$clock_nanosleep(Userspace<const Syscall::SC_clock_na return 0; } -KResultOr<int> Process::sys$adjtime(Userspace<const timeval*> user_delta, Userspace<timeval*> user_old_delta) +KResultOr<FlatPtr> Process::sys$adjtime(Userspace<const timeval*> user_delta, Userspace<timeval*> user_old_delta) { if (user_old_delta) { timespec old_delta_ts = TimeManagement::the().remaining_epoch_time_adjustment(); @@ -112,7 +112,7 @@ KResultOr<int> Process::sys$adjtime(Userspace<const timeval*> user_delta, Usersp return 0; } -KResultOr<int> Process::sys$gettimeofday(Userspace<timeval*> user_tv) +KResultOr<FlatPtr> Process::sys$gettimeofday(Userspace<timeval*> user_tv) { REQUIRE_PROMISE(stdio); auto tv = kgettimeofday().to_timeval(); diff --git a/Kernel/Syscalls/debug.cpp b/Kernel/Syscalls/debug.cpp index 38bf5591f9..d8b51f125a 100644 --- a/Kernel/Syscalls/debug.cpp +++ b/Kernel/Syscalls/debug.cpp @@ -11,19 +11,19 @@ namespace Kernel { -KResultOr<int> Process::sys$dump_backtrace() +KResultOr<FlatPtr> Process::sys$dump_backtrace() { dump_backtrace(); return 0; } -KResultOr<int> Process::sys$dbgputch(u8 ch) +KResultOr<FlatPtr> Process::sys$dbgputch(u8 ch) { dbgputch(ch); return 0; } -KResultOr<size_t> Process::sys$dbgputstr(Userspace<const u8*> characters, size_t size) +KResultOr<FlatPtr> Process::sys$dbgputstr(Userspace<const u8*> characters, size_t size) { if (size == 0) return 0; diff --git a/Kernel/Syscalls/disown.cpp b/Kernel/Syscalls/disown.cpp index 2d67f842a0..29ea3aa311 100644 --- a/Kernel/Syscalls/disown.cpp +++ b/Kernel/Syscalls/disown.cpp @@ -8,7 +8,7 @@ namespace Kernel { -KResultOr<int> Process::sys$disown(ProcessID pid) +KResultOr<FlatPtr> Process::sys$disown(ProcessID pid) { REQUIRE_PROMISE(proc); auto process = Process::from_pid(pid); diff --git a/Kernel/Syscalls/dup2.cpp b/Kernel/Syscalls/dup2.cpp index 46b30aeae6..6539b288e6 100644 --- a/Kernel/Syscalls/dup2.cpp +++ b/Kernel/Syscalls/dup2.cpp @@ -9,7 +9,7 @@ namespace Kernel { -KResultOr<int> Process::sys$dup2(int old_fd, int new_fd) +KResultOr<FlatPtr> Process::sys$dup2(int old_fd, int new_fd) { REQUIRE_PROMISE(stdio); auto description = file_description(old_fd); diff --git a/Kernel/Syscalls/emuctl.cpp b/Kernel/Syscalls/emuctl.cpp index 1107024241..e2849ae5ac 100644 --- a/Kernel/Syscalls/emuctl.cpp +++ b/Kernel/Syscalls/emuctl.cpp @@ -8,7 +8,7 @@ namespace Kernel { -KResultOr<int> Process::sys$emuctl() +KResultOr<FlatPtr> Process::sys$emuctl() { return ENOSYS; } diff --git a/Kernel/Syscalls/execve.cpp b/Kernel/Syscalls/execve.cpp index 1be665b3ed..037d7508a2 100644 --- a/Kernel/Syscalls/execve.cpp +++ b/Kernel/Syscalls/execve.cpp @@ -919,7 +919,7 @@ KResult Process::exec(String path, Vector<String> arguments, Vector<String> envi return KSuccess; } -KResultOr<int> Process::sys$execve(Userspace<const Syscall::SC_execve_params*> user_params) +KResultOr<FlatPtr> Process::sys$execve(Userspace<const Syscall::SC_execve_params*> user_params) { REQUIRE_PROMISE(exec); diff --git a/Kernel/Syscalls/fcntl.cpp b/Kernel/Syscalls/fcntl.cpp index 0ad942af1e..3f28418c54 100644 --- a/Kernel/Syscalls/fcntl.cpp +++ b/Kernel/Syscalls/fcntl.cpp @@ -10,7 +10,7 @@ namespace Kernel { -KResultOr<int> Process::sys$fcntl(int fd, int cmd, u32 arg) +KResultOr<FlatPtr> Process::sys$fcntl(int fd, int cmd, u32 arg) { REQUIRE_PROMISE(stdio); dbgln_if(IO_DEBUG, "sys$fcntl: fd={}, cmd={}, arg={}", fd, cmd, arg); diff --git a/Kernel/Syscalls/fork.cpp b/Kernel/Syscalls/fork.cpp index dab1ca807d..1a819f7dd9 100644 --- a/Kernel/Syscalls/fork.cpp +++ b/Kernel/Syscalls/fork.cpp @@ -14,7 +14,7 @@ namespace Kernel { -KResultOr<pid_t> Process::sys$fork(RegisterState& regs) +KResultOr<FlatPtr> Process::sys$fork(RegisterState& regs) { REQUIRE_PROMISE(proc); RefPtr<Thread> child_first_thread; diff --git a/Kernel/Syscalls/ftruncate.cpp b/Kernel/Syscalls/ftruncate.cpp index defea073c0..3497cb9bf8 100644 --- a/Kernel/Syscalls/ftruncate.cpp +++ b/Kernel/Syscalls/ftruncate.cpp @@ -9,7 +9,7 @@ namespace Kernel { -KResultOr<int> Process::sys$ftruncate(int fd, Userspace<off_t*> userspace_length) +KResultOr<FlatPtr> Process::sys$ftruncate(int fd, Userspace<off_t*> userspace_length) { REQUIRE_PROMISE(stdio); off_t length; diff --git a/Kernel/Syscalls/futex.cpp b/Kernel/Syscalls/futex.cpp index 33efb138fa..cd669e1dc7 100644 --- a/Kernel/Syscalls/futex.cpp +++ b/Kernel/Syscalls/futex.cpp @@ -82,7 +82,7 @@ void Process::clear_futex_queues_on_exec() m_futex_queues.clear(); } -KResultOr<int> Process::sys$futex(Userspace<const Syscall::SC_futex_params*> user_params) +KResultOr<FlatPtr> Process::sys$futex(Userspace<const Syscall::SC_futex_params*> user_params) { Syscall::SC_futex_params params; if (!copy_from_user(¶ms, user_params)) diff --git a/Kernel/Syscalls/get_dir_entries.cpp b/Kernel/Syscalls/get_dir_entries.cpp index b449e88dcd..6125d08efe 100644 --- a/Kernel/Syscalls/get_dir_entries.cpp +++ b/Kernel/Syscalls/get_dir_entries.cpp @@ -9,7 +9,7 @@ namespace Kernel { -KResultOr<size_t> Process::sys$get_dir_entries(int fd, Userspace<void*> user_buffer, size_t user_size) +KResultOr<FlatPtr> Process::sys$get_dir_entries(int fd, Userspace<void*> user_buffer, size_t user_size) { REQUIRE_PROMISE(stdio); if (user_size > NumericLimits<ssize_t>::max()) @@ -20,7 +20,11 @@ KResultOr<size_t> Process::sys$get_dir_entries(int fd, Userspace<void*> user_buf auto buffer = UserOrKernelBuffer::for_user_buffer(user_buffer, static_cast<size_t>(user_size)); if (!buffer.has_value()) return EFAULT; - return description->get_dir_entries(buffer.value(), user_size); + auto result = description->get_dir_entries(buffer.value(), user_size); + if (result.is_error()) + return result.error(); + else + return result.release_value(); } } diff --git a/Kernel/Syscalls/get_stack_bounds.cpp b/Kernel/Syscalls/get_stack_bounds.cpp index c3d0220073..2b351b5e09 100644 --- a/Kernel/Syscalls/get_stack_bounds.cpp +++ b/Kernel/Syscalls/get_stack_bounds.cpp @@ -10,7 +10,7 @@ namespace Kernel { -KResultOr<int> Process::sys$get_stack_bounds(Userspace<FlatPtr*> user_stack_base, Userspace<size_t*> user_stack_size) +KResultOr<FlatPtr> Process::sys$get_stack_bounds(Userspace<FlatPtr*> user_stack_base, Userspace<size_t*> user_stack_size) { auto& regs = Thread::current()->get_register_dump_from_stack(); FlatPtr stack_pointer; diff --git a/Kernel/Syscalls/getrandom.cpp b/Kernel/Syscalls/getrandom.cpp index c92cc5778e..c2c6dc9bbc 100644 --- a/Kernel/Syscalls/getrandom.cpp +++ b/Kernel/Syscalls/getrandom.cpp @@ -13,7 +13,7 @@ namespace Kernel { // We don't use the flag yet, but we could use it for distinguishing // random source like Linux, unlike the OpenBSD equivalent. However, if we // do, we should be able of the caveats that Linux has dealt with. -KResultOr<size_t> Process::sys$getrandom(Userspace<void*> buffer, size_t buffer_size, [[maybe_unused]] unsigned flags) +KResultOr<FlatPtr> Process::sys$getrandom(Userspace<void*> buffer, size_t buffer_size, [[maybe_unused]] unsigned flags) { REQUIRE_PROMISE(stdio); if (buffer_size > NumericLimits<ssize_t>::max()) @@ -22,10 +22,14 @@ KResultOr<size_t> Process::sys$getrandom(Userspace<void*> buffer, size_t buffer_ auto data_buffer = UserOrKernelBuffer::for_user_buffer(buffer, buffer_size); if (!data_buffer.has_value()) return EFAULT; - return data_buffer.value().write_buffered<1024>(buffer_size, [&](u8* buffer, size_t buffer_bytes) { + auto result = data_buffer.value().write_buffered<1024>(buffer_size, [&](u8* buffer, size_t buffer_bytes) { get_good_random_bytes(buffer, buffer_bytes); return buffer_bytes; }); + if (result.is_error()) + return result.error(); + else + return result.release_value(); } } diff --git a/Kernel/Syscalls/getuid.cpp b/Kernel/Syscalls/getuid.cpp index 349b0f651d..357607d702 100644 --- a/Kernel/Syscalls/getuid.cpp +++ b/Kernel/Syscalls/getuid.cpp @@ -8,31 +8,31 @@ namespace Kernel { -KResultOr<uid_t> Process::sys$getuid() +KResultOr<FlatPtr> Process::sys$getuid() { REQUIRE_PROMISE(stdio); return uid(); } -KResultOr<gid_t> Process::sys$getgid() +KResultOr<FlatPtr> Process::sys$getgid() { REQUIRE_PROMISE(stdio); return gid(); } -KResultOr<uid_t> Process::sys$geteuid() +KResultOr<FlatPtr> Process::sys$geteuid() { REQUIRE_PROMISE(stdio); return euid(); } -KResultOr<gid_t> Process::sys$getegid() +KResultOr<FlatPtr> Process::sys$getegid() { REQUIRE_PROMISE(stdio); return egid(); } -KResultOr<int> Process::sys$getresuid(Userspace<uid_t*> ruid, Userspace<uid_t*> euid, Userspace<uid_t*> suid) +KResultOr<FlatPtr> Process::sys$getresuid(Userspace<uid_t*> ruid, Userspace<uid_t*> euid, Userspace<uid_t*> suid) { REQUIRE_PROMISE(stdio); if (!copy_to_user(ruid, &m_uid) || !copy_to_user(euid, &m_euid) || !copy_to_user(suid, &m_suid)) @@ -40,7 +40,7 @@ KResultOr<int> Process::sys$getresuid(Userspace<uid_t*> ruid, Userspace<uid_t*> return 0; } -KResultOr<int> Process::sys$getresgid(Userspace<gid_t*> rgid, Userspace<gid_t*> egid, Userspace<gid_t*> sgid) +KResultOr<FlatPtr> Process::sys$getresgid(Userspace<gid_t*> rgid, Userspace<gid_t*> egid, Userspace<gid_t*> sgid) { REQUIRE_PROMISE(stdio); if (!copy_to_user(rgid, &m_gid) || !copy_to_user(egid, &m_egid) || !copy_to_user(sgid, &m_sgid)) @@ -48,7 +48,7 @@ KResultOr<int> Process::sys$getresgid(Userspace<gid_t*> rgid, Userspace<gid_t*> return 0; } -KResultOr<int> Process::sys$getgroups(size_t count, Userspace<gid_t*> user_gids) +KResultOr<FlatPtr> Process::sys$getgroups(size_t count, Userspace<gid_t*> user_gids) { REQUIRE_PROMISE(stdio); if (!count) diff --git a/Kernel/Syscalls/hostname.cpp b/Kernel/Syscalls/hostname.cpp index 7e9b18b931..f2b06ff445 100644 --- a/Kernel/Syscalls/hostname.cpp +++ b/Kernel/Syscalls/hostname.cpp @@ -11,7 +11,7 @@ namespace Kernel { extern String* g_hostname; extern Lock* g_hostname_lock; -KResultOr<int> Process::sys$gethostname(Userspace<char*> buffer, size_t size) +KResultOr<FlatPtr> Process::sys$gethostname(Userspace<char*> buffer, size_t size) { REQUIRE_PROMISE(stdio); if (size > NumericLimits<ssize_t>::max()) @@ -24,7 +24,7 @@ KResultOr<int> Process::sys$gethostname(Userspace<char*> buffer, size_t size) return 0; } -KResultOr<int> Process::sys$sethostname(Userspace<const char*> hostname, size_t length) +KResultOr<FlatPtr> Process::sys$sethostname(Userspace<const char*> hostname, size_t length) { REQUIRE_NO_PROMISES; if (!is_superuser()) diff --git a/Kernel/Syscalls/inode_watcher.cpp b/Kernel/Syscalls/inode_watcher.cpp index 6753f0c2d4..38a3b51e79 100644 --- a/Kernel/Syscalls/inode_watcher.cpp +++ b/Kernel/Syscalls/inode_watcher.cpp @@ -13,7 +13,7 @@ namespace Kernel { -KResultOr<int> Process::sys$create_inode_watcher(u32 flags) +KResultOr<FlatPtr> Process::sys$create_inode_watcher(u32 flags) { REQUIRE_PROMISE(rpath); @@ -40,7 +40,7 @@ KResultOr<int> Process::sys$create_inode_watcher(u32 flags) return fd; } -KResultOr<int> Process::sys$inode_watcher_add_watch(Userspace<const Syscall::SC_inode_watcher_add_watch_params*> user_params) +KResultOr<FlatPtr> Process::sys$inode_watcher_add_watch(Userspace<const Syscall::SC_inode_watcher_add_watch_params*> user_params) { REQUIRE_PROMISE(rpath); @@ -73,7 +73,7 @@ KResultOr<int> Process::sys$inode_watcher_add_watch(Userspace<const Syscall::SC_ return wd_or_error.value(); } -KResultOr<int> Process::sys$inode_watcher_remove_watch(int fd, int wd) +KResultOr<FlatPtr> Process::sys$inode_watcher_remove_watch(int fd, int wd) { auto description = file_description(fd); if (!description) diff --git a/Kernel/Syscalls/ioctl.cpp b/Kernel/Syscalls/ioctl.cpp index 98c5f655ca..8c2750b9f7 100644 --- a/Kernel/Syscalls/ioctl.cpp +++ b/Kernel/Syscalls/ioctl.cpp @@ -10,7 +10,7 @@ namespace Kernel { -KResultOr<int> Process::sys$ioctl(int fd, unsigned request, FlatPtr arg) +KResultOr<FlatPtr> Process::sys$ioctl(int fd, unsigned request, FlatPtr arg) { auto description = file_description(fd); if (!description) diff --git a/Kernel/Syscalls/keymap.cpp b/Kernel/Syscalls/keymap.cpp index 0ba64ae214..e8b051562d 100644 --- a/Kernel/Syscalls/keymap.cpp +++ b/Kernel/Syscalls/keymap.cpp @@ -11,7 +11,7 @@ namespace Kernel { constexpr size_t map_name_max_size = 50; -KResultOr<int> Process::sys$setkeymap(Userspace<const Syscall::SC_setkeymap_params*> user_params) +KResultOr<FlatPtr> Process::sys$setkeymap(Userspace<const Syscall::SC_setkeymap_params*> user_params) { REQUIRE_PROMISE(setkeymap); @@ -45,7 +45,7 @@ KResultOr<int> Process::sys$setkeymap(Userspace<const Syscall::SC_setkeymap_para return 0; } -KResultOr<int> Process::sys$getkeymap(Userspace<const Syscall::SC_getkeymap_params*> user_params) +KResultOr<FlatPtr> Process::sys$getkeymap(Userspace<const Syscall::SC_getkeymap_params*> user_params) { REQUIRE_PROMISE(getkeymap); diff --git a/Kernel/Syscalls/kill.cpp b/Kernel/Syscalls/kill.cpp index 93e1210cb0..1426a88dea 100644 --- a/Kernel/Syscalls/kill.cpp +++ b/Kernel/Syscalls/kill.cpp @@ -96,7 +96,7 @@ KResult Process::do_killself(int signal) return KSuccess; } -KResultOr<int> Process::sys$kill(pid_t pid_or_pgid, int signal) +KResultOr<FlatPtr> Process::sys$kill(pid_t pid_or_pgid, int signal) { if (pid_or_pgid == pid().value()) REQUIRE_PROMISE(stdio); @@ -123,7 +123,7 @@ KResultOr<int> Process::sys$kill(pid_t pid_or_pgid, int signal) return do_kill(*peer, signal); } -KResultOr<int> Process::sys$killpg(pid_t pgrp, int signum) +KResultOr<FlatPtr> Process::sys$killpg(pid_t pgrp, int signum) { REQUIRE_PROMISE(proc); if (signum < 1 || signum >= 32) diff --git a/Kernel/Syscalls/link.cpp b/Kernel/Syscalls/link.cpp index 13f8dc07d9..346a6c451b 100644 --- a/Kernel/Syscalls/link.cpp +++ b/Kernel/Syscalls/link.cpp @@ -10,7 +10,7 @@ namespace Kernel { -KResultOr<int> Process::sys$link(Userspace<const Syscall::SC_link_params*> user_params) +KResultOr<FlatPtr> Process::sys$link(Userspace<const Syscall::SC_link_params*> user_params) { REQUIRE_PROMISE(cpath); Syscall::SC_link_params params; @@ -25,7 +25,7 @@ KResultOr<int> Process::sys$link(Userspace<const Syscall::SC_link_params*> user_ return VFS::the().link(old_path, new_path, current_directory()); } -KResultOr<int> Process::sys$symlink(Userspace<const Syscall::SC_symlink_params*> user_params) +KResultOr<FlatPtr> Process::sys$symlink(Userspace<const Syscall::SC_symlink_params*> user_params) { REQUIRE_PROMISE(cpath); Syscall::SC_symlink_params params; diff --git a/Kernel/Syscalls/lseek.cpp b/Kernel/Syscalls/lseek.cpp index 94ee48a917..80e5415c89 100644 --- a/Kernel/Syscalls/lseek.cpp +++ b/Kernel/Syscalls/lseek.cpp @@ -9,7 +9,7 @@ namespace Kernel { -KResultOr<int> Process::sys$lseek(int fd, Userspace<off_t*> userspace_offset, int whence) +KResultOr<FlatPtr> Process::sys$lseek(int fd, Userspace<off_t*> userspace_offset, int whence) { REQUIRE_PROMISE(stdio); auto description = file_description(fd); diff --git a/Kernel/Syscalls/mkdir.cpp b/Kernel/Syscalls/mkdir.cpp index 8af8348543..9a7267daf3 100644 --- a/Kernel/Syscalls/mkdir.cpp +++ b/Kernel/Syscalls/mkdir.cpp @@ -10,7 +10,7 @@ namespace Kernel { -KResultOr<int> Process::sys$mkdir(Userspace<const char*> user_path, size_t path_length, mode_t mode) +KResultOr<FlatPtr> Process::sys$mkdir(Userspace<const char*> user_path, size_t path_length, mode_t mode) { REQUIRE_PROMISE(cpath); auto path = get_syscall_path_argument(user_path, path_length); diff --git a/Kernel/Syscalls/mknod.cpp b/Kernel/Syscalls/mknod.cpp index 5d3861c341..a3c1ac23f0 100644 --- a/Kernel/Syscalls/mknod.cpp +++ b/Kernel/Syscalls/mknod.cpp @@ -10,7 +10,7 @@ namespace Kernel { -KResultOr<int> Process::sys$mknod(Userspace<const Syscall::SC_mknod_params*> user_params) +KResultOr<FlatPtr> Process::sys$mknod(Userspace<const Syscall::SC_mknod_params*> user_params) { REQUIRE_PROMISE(dpath); Syscall::SC_mknod_params params; diff --git a/Kernel/Syscalls/mmap.cpp b/Kernel/Syscalls/mmap.cpp index 23d0d7dfd0..79353249ae 100644 --- a/Kernel/Syscalls/mmap.cpp +++ b/Kernel/Syscalls/mmap.cpp @@ -279,7 +279,7 @@ static KResultOr<Range> expand_range_to_page_boundaries(FlatPtr address, size_t return Range { base, end - base.get() }; } -KResultOr<int> Process::sys$mprotect(Userspace<void*> addr, size_t size, int prot) +KResultOr<FlatPtr> Process::sys$mprotect(Userspace<void*> addr, size_t size, int prot) { REQUIRE_PROMISE(stdio); @@ -421,7 +421,7 @@ KResultOr<int> Process::sys$mprotect(Userspace<void*> addr, size_t size, int pro return EINVAL; } -KResultOr<int> Process::sys$madvise(Userspace<void*> address, size_t size, int advice) +KResultOr<FlatPtr> Process::sys$madvise(Userspace<void*> address, size_t size, int advice) { REQUIRE_PROMISE(stdio); @@ -470,7 +470,7 @@ KResultOr<int> Process::sys$madvise(Userspace<void*> address, size_t size, int a return EINVAL; } -KResultOr<int> Process::sys$set_mmap_name(Userspace<const Syscall::SC_set_mmap_name_params*> user_params) +KResultOr<FlatPtr> Process::sys$set_mmap_name(Userspace<const Syscall::SC_set_mmap_name_params*> user_params) { REQUIRE_PROMISE(stdio); @@ -504,7 +504,7 @@ KResultOr<int> Process::sys$set_mmap_name(Userspace<const Syscall::SC_set_mmap_n return 0; } -KResultOr<int> Process::sys$munmap(Userspace<void*> addr, size_t size) +KResultOr<FlatPtr> Process::sys$munmap(Userspace<void*> addr, size_t size) { REQUIRE_PROMISE(stdio); @@ -618,7 +618,7 @@ KResultOr<FlatPtr> Process::sys$allocate_tls(Userspace<const char*> initial_data return m_master_tls_region.unsafe_ptr()->vaddr().get(); } -KResultOr<int> Process::sys$msyscall(Userspace<void*> address) +KResultOr<FlatPtr> Process::sys$msyscall(Userspace<void*> address) { if (space().enforces_syscall_regions()) return EPERM; diff --git a/Kernel/Syscalls/module.cpp b/Kernel/Syscalls/module.cpp index 9d267bd4ad..182fe22ae1 100644 --- a/Kernel/Syscalls/module.cpp +++ b/Kernel/Syscalls/module.cpp @@ -15,7 +15,7 @@ namespace Kernel { extern HashMap<String, OwnPtr<Module>>* g_modules; -KResultOr<int> Process::sys$module_load(Userspace<const char*> user_path, size_t path_length) +KResultOr<FlatPtr> Process::sys$module_load(Userspace<const char*> user_path, size_t path_length) { if (!is_superuser()) return EPERM; @@ -144,7 +144,7 @@ KResultOr<int> Process::sys$module_load(Userspace<const char*> user_path, size_t return 0; } -KResultOr<int> Process::sys$module_unload(Userspace<const char*> user_name, size_t name_length) +KResultOr<FlatPtr> Process::sys$module_unload(Userspace<const char*> user_name, size_t name_length) { if (!is_superuser()) return EPERM; diff --git a/Kernel/Syscalls/mount.cpp b/Kernel/Syscalls/mount.cpp index 237bb48a01..c6b9f7c5b8 100644 --- a/Kernel/Syscalls/mount.cpp +++ b/Kernel/Syscalls/mount.cpp @@ -16,7 +16,7 @@ namespace Kernel { -KResultOr<int> Process::sys$mount(Userspace<const Syscall::SC_mount_params*> user_params) +KResultOr<FlatPtr> Process::sys$mount(Userspace<const Syscall::SC_mount_params*> user_params) { if (!is_superuser()) return EPERM; @@ -111,7 +111,7 @@ KResultOr<int> Process::sys$mount(Userspace<const Syscall::SC_mount_params*> use return result; } -KResultOr<int> Process::sys$umount(Userspace<const char*> user_mountpoint, size_t mountpoint_length) +KResultOr<FlatPtr> Process::sys$umount(Userspace<const char*> user_mountpoint, size_t mountpoint_length) { if (!is_superuser()) return EPERM; diff --git a/Kernel/Syscalls/open.cpp b/Kernel/Syscalls/open.cpp index 4239839fd1..4df12ef4a7 100644 --- a/Kernel/Syscalls/open.cpp +++ b/Kernel/Syscalls/open.cpp @@ -12,7 +12,7 @@ namespace Kernel { -KResultOr<int> Process::sys$open(Userspace<const Syscall::SC_open_params*> user_params) +KResultOr<FlatPtr> Process::sys$open(Userspace<const Syscall::SC_open_params*> user_params) { Syscall::SC_open_params params; if (!copy_from_user(¶ms, user_params)) @@ -75,7 +75,7 @@ KResultOr<int> Process::sys$open(Userspace<const Syscall::SC_open_params*> user_ return fd; } -KResultOr<int> Process::sys$close(int fd) +KResultOr<FlatPtr> Process::sys$close(int fd) { REQUIRE_PROMISE(stdio); auto description = file_description(fd); diff --git a/Kernel/Syscalls/perf_event.cpp b/Kernel/Syscalls/perf_event.cpp index 94e4daf881..d95c170743 100644 --- a/Kernel/Syscalls/perf_event.cpp +++ b/Kernel/Syscalls/perf_event.cpp @@ -9,7 +9,7 @@ namespace Kernel { -KResultOr<int> Process::sys$perf_event(int type, FlatPtr arg1, FlatPtr arg2) +KResultOr<FlatPtr> Process::sys$perf_event(int type, FlatPtr arg1, FlatPtr arg2) { auto events_buffer = current_perf_events_buffer(); if (!events_buffer) { diff --git a/Kernel/Syscalls/pipe.cpp b/Kernel/Syscalls/pipe.cpp index d9b43c6fed..b289a3958a 100644 --- a/Kernel/Syscalls/pipe.cpp +++ b/Kernel/Syscalls/pipe.cpp @@ -10,7 +10,7 @@ namespace Kernel { -KResultOr<int> Process::sys$pipe(int pipefd[2], int flags) +KResultOr<FlatPtr> Process::sys$pipe(int pipefd[2], int flags) { REQUIRE_PROMISE(stdio); if (number_of_open_file_descriptors() + 2 > max_open_file_descriptors()) diff --git a/Kernel/Syscalls/pledge.cpp b/Kernel/Syscalls/pledge.cpp index 5f6f420ca4..b03a011598 100644 --- a/Kernel/Syscalls/pledge.cpp +++ b/Kernel/Syscalls/pledge.cpp @@ -9,7 +9,7 @@ namespace Kernel { -KResultOr<int> Process::sys$pledge(Userspace<const Syscall::SC_pledge_params*> user_params) +KResultOr<FlatPtr> Process::sys$pledge(Userspace<const Syscall::SC_pledge_params*> user_params) { Syscall::SC_pledge_params params; if (!copy_from_user(¶ms, user_params)) diff --git a/Kernel/Syscalls/prctl.cpp b/Kernel/Syscalls/prctl.cpp index 74b6a6f8fb..afe1d1ceae 100644 --- a/Kernel/Syscalls/prctl.cpp +++ b/Kernel/Syscalls/prctl.cpp @@ -9,7 +9,7 @@ namespace Kernel { -KResultOr<int> Process::sys$prctl(int option, FlatPtr arg1, [[maybe_unused]] FlatPtr arg2) +KResultOr<FlatPtr> Process::sys$prctl(int option, FlatPtr arg1, [[maybe_unused]] FlatPtr arg2) { switch (option) { case PR_GET_DUMPABLE: diff --git a/Kernel/Syscalls/process.cpp b/Kernel/Syscalls/process.cpp index 0afeec5400..708526892a 100644 --- a/Kernel/Syscalls/process.cpp +++ b/Kernel/Syscalls/process.cpp @@ -9,19 +9,19 @@ namespace Kernel { -KResultOr<pid_t> Process::sys$getpid() +KResultOr<FlatPtr> Process::sys$getpid() { REQUIRE_PROMISE(stdio); return pid().value(); } -KResultOr<pid_t> Process::sys$getppid() +KResultOr<FlatPtr> Process::sys$getppid() { REQUIRE_PROMISE(stdio); return m_ppid.value(); } -KResultOr<int> Process::sys$get_process_name(Userspace<char*> buffer, size_t buffer_size) +KResultOr<FlatPtr> Process::sys$get_process_name(Userspace<char*> buffer, size_t buffer_size) { REQUIRE_PROMISE(stdio); if (m_name.length() + 1 > buffer_size) @@ -32,7 +32,7 @@ KResultOr<int> Process::sys$get_process_name(Userspace<char*> buffer, size_t buf return 0; } -KResultOr<int> Process::sys$set_process_name(Userspace<const char*> user_name, size_t user_name_length) +KResultOr<FlatPtr> Process::sys$set_process_name(Userspace<const char*> user_name, size_t user_name_length) { REQUIRE_PROMISE(proc); if (user_name_length > 256) @@ -47,7 +47,7 @@ KResultOr<int> Process::sys$set_process_name(Userspace<const char*> user_name, s return 0; } -KResultOr<int> Process::sys$set_coredump_metadata(Userspace<const Syscall::SC_set_coredump_metadata_params*> user_params) +KResultOr<FlatPtr> Process::sys$set_coredump_metadata(Userspace<const Syscall::SC_set_coredump_metadata_params*> user_params) { Syscall::SC_set_coredump_metadata_params params; if (!copy_from_user(¶ms, user_params)) diff --git a/Kernel/Syscalls/profiling.cpp b/Kernel/Syscalls/profiling.cpp index 8ce08dbaf0..953bb7230e 100644 --- a/Kernel/Syscalls/profiling.cpp +++ b/Kernel/Syscalls/profiling.cpp @@ -17,7 +17,7 @@ bool g_profiling_all_threads; PerformanceEventBuffer* g_global_perf_events; u64 g_profiling_event_mask; -KResultOr<int> Process::sys$profiling_enable(pid_t pid, u64 event_mask) +KResultOr<FlatPtr> Process::sys$profiling_enable(pid_t pid, u64 event_mask) { REQUIRE_NO_PROMISES; @@ -66,7 +66,7 @@ KResultOr<int> Process::sys$profiling_enable(pid_t pid, u64 event_mask) return 0; } -KResultOr<int> Process::sys$profiling_disable(pid_t pid) +KResultOr<FlatPtr> Process::sys$profiling_disable(pid_t pid) { REQUIRE_NO_PROMISES; @@ -95,7 +95,7 @@ KResultOr<int> Process::sys$profiling_disable(pid_t pid) return 0; } -KResultOr<int> Process::sys$profiling_free_buffer(pid_t pid) +KResultOr<FlatPtr> Process::sys$profiling_free_buffer(pid_t pid) { REQUIRE_NO_PROMISES; diff --git a/Kernel/Syscalls/ptrace.cpp b/Kernel/Syscalls/ptrace.cpp index c8a210b701..ecdeb4b1d3 100644 --- a/Kernel/Syscalls/ptrace.cpp +++ b/Kernel/Syscalls/ptrace.cpp @@ -155,7 +155,7 @@ static KResultOr<u32> handle_ptrace(const Kernel::Syscall::SC_ptrace_params& par return KSuccess; } -KResultOr<int> Process::sys$ptrace(Userspace<const Syscall::SC_ptrace_params*> user_params) +KResultOr<FlatPtr> Process::sys$ptrace(Userspace<const Syscall::SC_ptrace_params*> user_params) { REQUIRE_PROMISE(ptrace); Syscall::SC_ptrace_params params {}; diff --git a/Kernel/Syscalls/purge.cpp b/Kernel/Syscalls/purge.cpp index 488f167035..9701b910a9 100644 --- a/Kernel/Syscalls/purge.cpp +++ b/Kernel/Syscalls/purge.cpp @@ -13,7 +13,7 @@ namespace Kernel { -KResultOr<int> Process::sys$purge(int mode) +KResultOr<FlatPtr> Process::sys$purge(int mode) { REQUIRE_NO_PROMISES; if (!is_superuser()) diff --git a/Kernel/Syscalls/read.cpp b/Kernel/Syscalls/read.cpp index df9c30ab2b..f37b3d9d32 100644 --- a/Kernel/Syscalls/read.cpp +++ b/Kernel/Syscalls/read.cpp @@ -12,7 +12,7 @@ namespace Kernel { using BlockFlags = Thread::FileBlocker::BlockFlags; -KResultOr<size_t> Process::sys$readv(int fd, Userspace<const struct iovec*> iov, int iov_count) +KResultOr<FlatPtr> Process::sys$readv(int fd, Userspace<const struct iovec*> iov, int iov_count) { REQUIRE_PROMISE(stdio); if (iov_count < 0) @@ -68,7 +68,7 @@ KResultOr<size_t> Process::sys$readv(int fd, Userspace<const struct iovec*> iov, return nread; } -KResultOr<size_t> Process::sys$read(int fd, Userspace<u8*> buffer, size_t size) +KResultOr<FlatPtr> Process::sys$read(int fd, Userspace<u8*> buffer, size_t size) { REQUIRE_PROMISE(stdio); if (size == 0) diff --git a/Kernel/Syscalls/readlink.cpp b/Kernel/Syscalls/readlink.cpp index ad331a1033..4095bface6 100644 --- a/Kernel/Syscalls/readlink.cpp +++ b/Kernel/Syscalls/readlink.cpp @@ -11,7 +11,7 @@ namespace Kernel { -KResultOr<int> Process::sys$readlink(Userspace<const Syscall::SC_readlink_params*> user_params) +KResultOr<FlatPtr> Process::sys$readlink(Userspace<const Syscall::SC_readlink_params*> user_params) { REQUIRE_PROMISE(rpath); diff --git a/Kernel/Syscalls/realpath.cpp b/Kernel/Syscalls/realpath.cpp index 5bbe29db7b..497f9cbf22 100644 --- a/Kernel/Syscalls/realpath.cpp +++ b/Kernel/Syscalls/realpath.cpp @@ -11,7 +11,7 @@ namespace Kernel { -KResultOr<int> Process::sys$realpath(Userspace<const Syscall::SC_realpath_params*> user_params) +KResultOr<FlatPtr> Process::sys$realpath(Userspace<const Syscall::SC_realpath_params*> user_params) { REQUIRE_PROMISE(rpath); diff --git a/Kernel/Syscalls/rename.cpp b/Kernel/Syscalls/rename.cpp index 4aaea17db2..2dcc517f23 100644 --- a/Kernel/Syscalls/rename.cpp +++ b/Kernel/Syscalls/rename.cpp @@ -10,7 +10,7 @@ namespace Kernel { -KResultOr<int> Process::sys$rename(Userspace<const Syscall::SC_rename_params*> user_params) +KResultOr<FlatPtr> Process::sys$rename(Userspace<const Syscall::SC_rename_params*> user_params) { REQUIRE_PROMISE(cpath); Syscall::SC_rename_params params; diff --git a/Kernel/Syscalls/rmdir.cpp b/Kernel/Syscalls/rmdir.cpp index 921871f441..2a7e9115f1 100644 --- a/Kernel/Syscalls/rmdir.cpp +++ b/Kernel/Syscalls/rmdir.cpp @@ -10,7 +10,7 @@ namespace Kernel { -KResultOr<int> Process::sys$rmdir(Userspace<const char*> user_path, size_t path_length) +KResultOr<FlatPtr> Process::sys$rmdir(Userspace<const char*> user_path, size_t path_length) { REQUIRE_PROMISE(cpath); auto path = get_syscall_path_argument(user_path, path_length); diff --git a/Kernel/Syscalls/sched.cpp b/Kernel/Syscalls/sched.cpp index 4f791d1665..7bbc04ca35 100644 --- a/Kernel/Syscalls/sched.cpp +++ b/Kernel/Syscalls/sched.cpp @@ -8,14 +8,14 @@ namespace Kernel { -KResultOr<int> Process::sys$yield() +KResultOr<FlatPtr> Process::sys$yield() { REQUIRE_PROMISE(stdio); Thread::current()->yield_without_holding_big_lock(); return 0; } -KResultOr<int> Process::sys$donate(pid_t tid) +KResultOr<FlatPtr> Process::sys$donate(pid_t tid) { REQUIRE_PROMISE(stdio); if (tid < 0) @@ -29,7 +29,7 @@ KResultOr<int> Process::sys$donate(pid_t tid) return 0; } -KResultOr<int> Process::sys$sched_setparam(int pid, Userspace<const struct sched_param*> user_param) +KResultOr<FlatPtr> Process::sys$sched_setparam(int pid, Userspace<const struct sched_param*> user_param) { REQUIRE_PROMISE(proc); struct sched_param desired_param; @@ -54,7 +54,7 @@ KResultOr<int> Process::sys$sched_setparam(int pid, Userspace<const struct sched return 0; } -KResultOr<int> Process::sys$sched_getparam(pid_t pid, Userspace<struct sched_param*> user_param) +KResultOr<FlatPtr> Process::sys$sched_getparam(pid_t pid, Userspace<struct sched_param*> user_param) { REQUIRE_PROMISE(proc); int priority; diff --git a/Kernel/Syscalls/select.cpp b/Kernel/Syscalls/select.cpp index e0d7bb7411..87b61a4721 100644 --- a/Kernel/Syscalls/select.cpp +++ b/Kernel/Syscalls/select.cpp @@ -14,7 +14,7 @@ namespace Kernel { using BlockFlags = Thread::FileBlocker::BlockFlags; -KResultOr<int> Process::sys$select(Userspace<const Syscall::SC_select_params*> user_params) +KResultOr<FlatPtr> Process::sys$select(Userspace<const Syscall::SC_select_params*> user_params) { REQUIRE_PROMISE(stdio); Syscall::SC_select_params params {}; @@ -127,7 +127,7 @@ KResultOr<int> Process::sys$select(Userspace<const Syscall::SC_select_params*> u return marked_fd_count; } -KResultOr<int> Process::sys$poll(Userspace<const Syscall::SC_poll_params*> user_params) +KResultOr<FlatPtr> Process::sys$poll(Userspace<const Syscall::SC_poll_params*> user_params) { REQUIRE_PROMISE(stdio); diff --git a/Kernel/Syscalls/sendfd.cpp b/Kernel/Syscalls/sendfd.cpp index c33fdfe77a..f4f47e490d 100644 --- a/Kernel/Syscalls/sendfd.cpp +++ b/Kernel/Syscalls/sendfd.cpp @@ -10,7 +10,7 @@ namespace Kernel { -KResultOr<int> Process::sys$sendfd(int sockfd, int fd) +KResultOr<FlatPtr> Process::sys$sendfd(int sockfd, int fd) { REQUIRE_PROMISE(sendfd); auto socket_description = file_description(sockfd); @@ -32,7 +32,7 @@ KResultOr<int> Process::sys$sendfd(int sockfd, int fd) return local_socket.sendfd(*socket_description, *passing_descriptor); } -KResultOr<int> Process::sys$recvfd(int sockfd, int options) +KResultOr<FlatPtr> Process::sys$recvfd(int sockfd, int options) { REQUIRE_PROMISE(recvfd); auto socket_description = file_description(sockfd); diff --git a/Kernel/Syscalls/setpgid.cpp b/Kernel/Syscalls/setpgid.cpp index ab3e9ecffe..0ec1324995 100644 --- a/Kernel/Syscalls/setpgid.cpp +++ b/Kernel/Syscalls/setpgid.cpp @@ -10,7 +10,7 @@ namespace Kernel { -KResultOr<pid_t> Process::sys$getsid(pid_t pid) +KResultOr<FlatPtr> Process::sys$getsid(pid_t pid) { REQUIRE_PROMISE(proc); if (pid == 0) @@ -24,7 +24,7 @@ KResultOr<pid_t> Process::sys$getsid(pid_t pid) return process->sid().value(); } -KResultOr<pid_t> Process::sys$setsid() +KResultOr<FlatPtr> Process::sys$setsid() { REQUIRE_PROMISE(proc); InterruptDisabler disabler; @@ -43,7 +43,7 @@ KResultOr<pid_t> Process::sys$setsid() return sid().value(); } -KResultOr<pid_t> Process::sys$getpgid(pid_t pid) +KResultOr<FlatPtr> Process::sys$getpgid(pid_t pid) { REQUIRE_PROMISE(proc); if (pid == 0) @@ -55,7 +55,7 @@ KResultOr<pid_t> Process::sys$getpgid(pid_t pid) return process->pgid().value(); } -KResultOr<pid_t> Process::sys$getpgrp() +KResultOr<FlatPtr> Process::sys$getpgrp() { REQUIRE_PROMISE(stdio); return pgid().value(); @@ -75,7 +75,7 @@ SessionID Process::get_sid_from_pgid(ProcessGroupID pgid) return sid; } -KResultOr<int> Process::sys$setpgid(pid_t specified_pid, pid_t specified_pgid) +KResultOr<FlatPtr> Process::sys$setpgid(pid_t specified_pid, pid_t specified_pgid) { REQUIRE_PROMISE(proc); ScopedSpinLock lock(g_processes_lock); // FIXME: Use a ProcessHandle diff --git a/Kernel/Syscalls/setuid.cpp b/Kernel/Syscalls/setuid.cpp index 0269e71464..bc52b2691f 100644 --- a/Kernel/Syscalls/setuid.cpp +++ b/Kernel/Syscalls/setuid.cpp @@ -8,7 +8,7 @@ namespace Kernel { -KResultOr<int> Process::sys$seteuid(uid_t new_euid) +KResultOr<FlatPtr> Process::sys$seteuid(uid_t new_euid) { REQUIRE_PROMISE(id); @@ -24,7 +24,7 @@ KResultOr<int> Process::sys$seteuid(uid_t new_euid) return 0; } -KResultOr<int> Process::sys$setegid(gid_t new_egid) +KResultOr<FlatPtr> Process::sys$setegid(gid_t new_egid) { REQUIRE_PROMISE(id); @@ -39,7 +39,7 @@ KResultOr<int> Process::sys$setegid(gid_t new_egid) return 0; } -KResultOr<int> Process::sys$setuid(uid_t new_uid) +KResultOr<FlatPtr> Process::sys$setuid(uid_t new_uid) { REQUIRE_PROMISE(id); @@ -56,7 +56,7 @@ KResultOr<int> Process::sys$setuid(uid_t new_uid) return 0; } -KResultOr<int> Process::sys$setgid(gid_t new_gid) +KResultOr<FlatPtr> Process::sys$setgid(gid_t new_gid) { REQUIRE_PROMISE(id); @@ -73,7 +73,7 @@ KResultOr<int> Process::sys$setgid(gid_t new_gid) return 0; } -KResultOr<int> Process::sys$setreuid(uid_t new_ruid, uid_t new_euid) +KResultOr<FlatPtr> Process::sys$setreuid(uid_t new_ruid, uid_t new_euid) { REQUIRE_PROMISE(id); @@ -98,7 +98,7 @@ KResultOr<int> Process::sys$setreuid(uid_t new_ruid, uid_t new_euid) return 0; } -KResultOr<int> Process::sys$setresuid(uid_t new_ruid, uid_t new_euid, uid_t new_suid) +KResultOr<FlatPtr> Process::sys$setresuid(uid_t new_ruid, uid_t new_euid, uid_t new_suid) { REQUIRE_PROMISE(id); @@ -123,7 +123,7 @@ KResultOr<int> Process::sys$setresuid(uid_t new_ruid, uid_t new_euid, uid_t new_ return 0; } -KResultOr<int> Process::sys$setresgid(gid_t new_rgid, gid_t new_egid, gid_t new_sgid) +KResultOr<FlatPtr> Process::sys$setresgid(gid_t new_rgid, gid_t new_egid, gid_t new_sgid) { REQUIRE_PROMISE(id); @@ -148,7 +148,7 @@ KResultOr<int> Process::sys$setresgid(gid_t new_rgid, gid_t new_egid, gid_t new_ return 0; } -KResultOr<int> Process::sys$setgroups(size_t count, Userspace<const gid_t*> user_gids) +KResultOr<FlatPtr> Process::sys$setgroups(size_t count, Userspace<const gid_t*> user_gids) { REQUIRE_PROMISE(id); if (!is_superuser()) diff --git a/Kernel/Syscalls/shutdown.cpp b/Kernel/Syscalls/shutdown.cpp index 22338483a6..2b3ab45fa0 100644 --- a/Kernel/Syscalls/shutdown.cpp +++ b/Kernel/Syscalls/shutdown.cpp @@ -12,7 +12,7 @@ namespace Kernel { -KResultOr<int> Process::sys$reboot() +KResultOr<FlatPtr> Process::sys$reboot() { if (!is_superuser()) return EPERM; @@ -32,7 +32,7 @@ KResultOr<int> Process::sys$reboot() return 0; } -KResultOr<int> Process::sys$halt() +KResultOr<FlatPtr> Process::sys$halt() { if (!is_superuser()) return EPERM; diff --git a/Kernel/Syscalls/sigaction.cpp b/Kernel/Syscalls/sigaction.cpp index 8221aeb2fa..1b07db25a9 100644 --- a/Kernel/Syscalls/sigaction.cpp +++ b/Kernel/Syscalls/sigaction.cpp @@ -11,7 +11,7 @@ namespace Kernel { -KResultOr<int> Process::sys$sigprocmask(int how, Userspace<const sigset_t*> set, Userspace<sigset_t*> old_set) +KResultOr<FlatPtr> Process::sys$sigprocmask(int how, Userspace<const sigset_t*> set, Userspace<sigset_t*> old_set) { REQUIRE_PROMISE(sigaction); auto current_thread = Thread::current(); @@ -41,7 +41,7 @@ KResultOr<int> Process::sys$sigprocmask(int how, Userspace<const sigset_t*> set, return 0; } -KResultOr<int> Process::sys$sigpending(Userspace<sigset_t*> set) +KResultOr<FlatPtr> Process::sys$sigpending(Userspace<sigset_t*> set) { REQUIRE_PROMISE(stdio); auto pending_signals = Thread::current()->pending_signals(); @@ -50,7 +50,7 @@ KResultOr<int> Process::sys$sigpending(Userspace<sigset_t*> set) return 0; } -KResultOr<int> Process::sys$sigaction(int signum, Userspace<const sigaction*> user_act, Userspace<sigaction*> user_old_act) +KResultOr<FlatPtr> Process::sys$sigaction(int signum, Userspace<const sigaction*> user_act, Userspace<sigaction*> user_old_act) { REQUIRE_PROMISE(sigaction); if (signum < 1 || signum >= 32 || signum == SIGKILL || signum == SIGSTOP) @@ -75,7 +75,7 @@ KResultOr<int> Process::sys$sigaction(int signum, Userspace<const sigaction*> us return 0; } -KResultOr<int> Process::sys$sigreturn([[maybe_unused]] RegisterState& registers) +KResultOr<FlatPtr> Process::sys$sigreturn([[maybe_unused]] RegisterState& registers) { REQUIRE_PROMISE(stdio); SmapDisabler disabler; diff --git a/Kernel/Syscalls/socket.cpp b/Kernel/Syscalls/socket.cpp index 1c70666a0a..b18906e413 100644 --- a/Kernel/Syscalls/socket.cpp +++ b/Kernel/Syscalls/socket.cpp @@ -32,7 +32,7 @@ void Process::setup_socket_fd(int fd, NonnullRefPtr<FileDescription> description m_fds[fd].set(*description, flags); } -KResultOr<int> Process::sys$socket(int domain, int type, int protocol) +KResultOr<FlatPtr> Process::sys$socket(int domain, int type, int protocol) { REQUIRE_PROMISE_FOR_SOCKET_DOMAIN(domain); @@ -51,7 +51,7 @@ KResultOr<int> Process::sys$socket(int domain, int type, int protocol) return fd; } -KResultOr<int> Process::sys$bind(int sockfd, Userspace<const sockaddr*> address, socklen_t address_length) +KResultOr<FlatPtr> Process::sys$bind(int sockfd, Userspace<const sockaddr*> address, socklen_t address_length) { auto description = file_description(sockfd); if (!description) @@ -63,7 +63,7 @@ KResultOr<int> Process::sys$bind(int sockfd, Userspace<const sockaddr*> address, return socket.bind(address, address_length); } -KResultOr<int> Process::sys$listen(int sockfd, int backlog) +KResultOr<FlatPtr> Process::sys$listen(int sockfd, int backlog) { if (backlog < 0) return EINVAL; @@ -79,7 +79,7 @@ KResultOr<int> Process::sys$listen(int sockfd, int backlog) return socket.listen(backlog); } -KResultOr<int> Process::sys$accept4(Userspace<const Syscall::SC_accept4_params*> user_params) +KResultOr<FlatPtr> Process::sys$accept4(Userspace<const Syscall::SC_accept4_params*> user_params) { REQUIRE_PROMISE(accept); @@ -146,7 +146,7 @@ KResultOr<int> Process::sys$accept4(Userspace<const Syscall::SC_accept4_params*> return accepted_socket_fd; } -KResultOr<int> Process::sys$connect(int sockfd, Userspace<const sockaddr*> user_address, socklen_t user_address_size) +KResultOr<FlatPtr> Process::sys$connect(int sockfd, Userspace<const sockaddr*> user_address, socklen_t user_address_size) { int fd = alloc_fd(); if (fd < 0) @@ -163,7 +163,7 @@ KResultOr<int> Process::sys$connect(int sockfd, Userspace<const sockaddr*> user_ return socket.connect(*description, user_address, user_address_size, description->is_blocking() ? ShouldBlock::Yes : ShouldBlock::No); } -KResultOr<int> Process::sys$shutdown(int sockfd, int how) +KResultOr<FlatPtr> Process::sys$shutdown(int sockfd, int how) { REQUIRE_PROMISE(stdio); if (how & ~SHUT_RDWR) @@ -179,7 +179,7 @@ KResultOr<int> Process::sys$shutdown(int sockfd, int how) return socket.shutdown(how); } -KResultOr<size_t> Process::sys$sendmsg(int sockfd, Userspace<const struct msghdr*> user_msg, int flags) +KResultOr<FlatPtr> Process::sys$sendmsg(int sockfd, Userspace<const struct msghdr*> user_msg, int flags) { REQUIRE_PROMISE(stdio); struct msghdr msg; @@ -210,10 +210,14 @@ KResultOr<size_t> Process::sys$sendmsg(int sockfd, Userspace<const struct msghdr auto data_buffer = UserOrKernelBuffer::for_user_buffer((u8*)iovs[0].iov_base, iovs[0].iov_len); if (!data_buffer.has_value()) return EFAULT; - return socket.sendto(*description, data_buffer.value(), iovs[0].iov_len, flags, user_addr, addr_length); + auto result = socket.sendto(*description, data_buffer.value(), iovs[0].iov_len, flags, user_addr, addr_length); + if (result.is_error()) + return result.error(); + else + return result.release_value(); } -KResultOr<size_t> Process::sys$recvmsg(int sockfd, Userspace<struct msghdr*> user_msg, int flags) +KResultOr<FlatPtr> Process::sys$recvmsg(int sockfd, Userspace<struct msghdr*> user_msg, int flags) { REQUIRE_PROMISE(stdio); @@ -320,7 +324,7 @@ int Process::get_sock_or_peer_name(const Params& params) return 0; } -KResultOr<int> Process::sys$getsockname(Userspace<const Syscall::SC_getsockname_params*> user_params) +KResultOr<FlatPtr> Process::sys$getsockname(Userspace<const Syscall::SC_getsockname_params*> user_params) { Syscall::SC_getsockname_params params; if (!copy_from_user(¶ms, user_params)) @@ -328,7 +332,7 @@ KResultOr<int> Process::sys$getsockname(Userspace<const Syscall::SC_getsockname_ return get_sock_or_peer_name<true>(params); } -KResultOr<int> Process::sys$getpeername(Userspace<const Syscall::SC_getpeername_params*> user_params) +KResultOr<FlatPtr> Process::sys$getpeername(Userspace<const Syscall::SC_getpeername_params*> user_params) { Syscall::SC_getpeername_params params; if (!copy_from_user(¶ms, user_params)) @@ -336,7 +340,7 @@ KResultOr<int> Process::sys$getpeername(Userspace<const Syscall::SC_getpeername_ return get_sock_or_peer_name<false>(params); } -KResultOr<int> Process::sys$getsockopt(Userspace<const Syscall::SC_getsockopt_params*> user_params) +KResultOr<FlatPtr> Process::sys$getsockopt(Userspace<const Syscall::SC_getsockopt_params*> user_params) { Syscall::SC_getsockopt_params params; if (!copy_from_user(¶ms, user_params)) @@ -363,7 +367,7 @@ KResultOr<int> Process::sys$getsockopt(Userspace<const Syscall::SC_getsockopt_pa return socket.getsockopt(*description, level, option, user_value, user_value_size); } -KResultOr<int> Process::sys$setsockopt(Userspace<const Syscall::SC_setsockopt_params*> user_params) +KResultOr<FlatPtr> Process::sys$setsockopt(Userspace<const Syscall::SC_setsockopt_params*> user_params) { Syscall::SC_setsockopt_params params; if (!copy_from_user(¶ms, user_params)) @@ -379,7 +383,7 @@ KResultOr<int> Process::sys$setsockopt(Userspace<const Syscall::SC_setsockopt_pa return socket.setsockopt(params.level, params.option, user_value, params.value_size); } -KResultOr<int> Process::sys$socketpair(Userspace<const Syscall::SC_socketpair_params*> user_params) +KResultOr<FlatPtr> Process::sys$socketpair(Userspace<const Syscall::SC_socketpair_params*> user_params) { Syscall::SC_socketpair_params params; if (!copy_from_user(¶ms, user_params)) diff --git a/Kernel/Syscalls/stat.cpp b/Kernel/Syscalls/stat.cpp index 810daed284..60b7ddff3a 100644 --- a/Kernel/Syscalls/stat.cpp +++ b/Kernel/Syscalls/stat.cpp @@ -12,7 +12,7 @@ namespace Kernel { -KResultOr<int> Process::sys$fstat(int fd, Userspace<stat*> user_statbuf) +KResultOr<FlatPtr> Process::sys$fstat(int fd, Userspace<stat*> user_statbuf) { REQUIRE_PROMISE(stdio); auto description = file_description(fd); @@ -25,7 +25,7 @@ KResultOr<int> Process::sys$fstat(int fd, Userspace<stat*> user_statbuf) return rc; } -KResultOr<int> Process::sys$stat(Userspace<const Syscall::SC_stat_params*> user_params) +KResultOr<FlatPtr> Process::sys$stat(Userspace<const Syscall::SC_stat_params*> user_params) { REQUIRE_PROMISE(rpath); Syscall::SC_stat_params params; diff --git a/Kernel/Syscalls/statvfs.cpp b/Kernel/Syscalls/statvfs.cpp index 5103567e2a..0e6562a7be 100644 --- a/Kernel/Syscalls/statvfs.cpp +++ b/Kernel/Syscalls/statvfs.cpp @@ -11,7 +11,7 @@ namespace Kernel { -KResultOr<int> Process::do_statvfs(String path, statvfs* buf) +KResultOr<FlatPtr> Process::do_statvfs(String path, statvfs* buf) { auto custody_or_error = VFS::the().resolve_path(path, current_directory(), nullptr, 0); if (custody_or_error.is_error()) @@ -69,7 +69,7 @@ KResultOr<int> Process::do_statvfs(String path, statvfs* buf) return 0; } -KResultOr<int> Process::sys$statvfs(Userspace<const Syscall::SC_statvfs_params*> user_params) +KResultOr<FlatPtr> Process::sys$statvfs(Userspace<const Syscall::SC_statvfs_params*> user_params) { REQUIRE_PROMISE(rpath); @@ -83,7 +83,7 @@ KResultOr<int> Process::sys$statvfs(Userspace<const Syscall::SC_statvfs_params*> return do_statvfs(path.value()->view(), params.buf); } -KResultOr<int> Process::sys$fstatvfs(int fd, statvfs* buf) +KResultOr<FlatPtr> Process::sys$fstatvfs(int fd, statvfs* buf) { REQUIRE_PROMISE(stdio); diff --git a/Kernel/Syscalls/sync.cpp b/Kernel/Syscalls/sync.cpp index 6801d4caa9..7b78ba5626 100644 --- a/Kernel/Syscalls/sync.cpp +++ b/Kernel/Syscalls/sync.cpp @@ -9,7 +9,7 @@ namespace Kernel { -KResultOr<int> Process::sys$sync() +KResultOr<FlatPtr> Process::sys$sync() { REQUIRE_PROMISE(stdio); VFS::the().sync(); diff --git a/Kernel/Syscalls/sysconf.cpp b/Kernel/Syscalls/sysconf.cpp index 0b1e575731..9460b7c585 100644 --- a/Kernel/Syscalls/sysconf.cpp +++ b/Kernel/Syscalls/sysconf.cpp @@ -9,7 +9,7 @@ namespace Kernel { -KResultOr<long> Process::sys$sysconf(int name) +KResultOr<FlatPtr> Process::sys$sysconf(int name) { switch (name) { case _SC_MONOTONIC_CLOCK: diff --git a/Kernel/Syscalls/thread.cpp b/Kernel/Syscalls/thread.cpp index 995254545b..b9a4a2992a 100644 --- a/Kernel/Syscalls/thread.cpp +++ b/Kernel/Syscalls/thread.cpp @@ -16,7 +16,7 @@ namespace Kernel { -KResultOr<int> Process::sys$create_thread(void* (*entry)(void*), Userspace<const Syscall::SC_create_thread_params*> user_params) +KResultOr<FlatPtr> Process::sys$create_thread(void* (*entry)(void*), Userspace<const Syscall::SC_create_thread_params*> user_params) { REQUIRE_PROMISE(thread); @@ -108,7 +108,7 @@ void Process::sys$exit_thread(Userspace<void*> exit_value, Userspace<void*> stac VERIFY_NOT_REACHED(); } -KResultOr<int> Process::sys$detach_thread(pid_t tid) +KResultOr<FlatPtr> Process::sys$detach_thread(pid_t tid) { REQUIRE_PROMISE(thread); auto thread = Thread::from_tid(tid); @@ -122,7 +122,7 @@ KResultOr<int> Process::sys$detach_thread(pid_t tid) return 0; } -KResultOr<int> Process::sys$join_thread(pid_t tid, Userspace<void**> exit_value) +KResultOr<FlatPtr> Process::sys$join_thread(pid_t tid, Userspace<void**> exit_value) { REQUIRE_PROMISE(thread); @@ -155,7 +155,7 @@ KResultOr<int> Process::sys$join_thread(pid_t tid, Userspace<void**> exit_value) return 0; } -KResultOr<int> Process::sys$set_thread_name(pid_t tid, Userspace<const char*> user_name, size_t user_name_length) +KResultOr<FlatPtr> Process::sys$set_thread_name(pid_t tid, Userspace<const char*> user_name, size_t user_name_length) { REQUIRE_PROMISE(stdio); auto name = copy_string_from_user(user_name, user_name_length); @@ -174,7 +174,7 @@ KResultOr<int> Process::sys$set_thread_name(pid_t tid, Userspace<const char*> us return 0; } -KResultOr<int> Process::sys$get_thread_name(pid_t tid, Userspace<char*> buffer, size_t buffer_size) +KResultOr<FlatPtr> Process::sys$get_thread_name(pid_t tid, Userspace<char*> buffer, size_t buffer_size) { REQUIRE_PROMISE(thread); if (buffer_size == 0) @@ -194,7 +194,7 @@ KResultOr<int> Process::sys$get_thread_name(pid_t tid, Userspace<char*> buffer, return 0; } -KResultOr<int> Process::sys$gettid() +KResultOr<FlatPtr> Process::sys$gettid() { REQUIRE_PROMISE(stdio); return Thread::current()->tid().value(); diff --git a/Kernel/Syscalls/times.cpp b/Kernel/Syscalls/times.cpp index 81c856c2a9..445006f678 100644 --- a/Kernel/Syscalls/times.cpp +++ b/Kernel/Syscalls/times.cpp @@ -8,7 +8,7 @@ namespace Kernel { -KResultOr<clock_t> Process::sys$times(Userspace<tms*> user_times) +KResultOr<FlatPtr> Process::sys$times(Userspace<tms*> user_times) { REQUIRE_PROMISE(stdio); tms times = {}; diff --git a/Kernel/Syscalls/ttyname.cpp b/Kernel/Syscalls/ttyname.cpp index a6354b8a25..c544b52a13 100644 --- a/Kernel/Syscalls/ttyname.cpp +++ b/Kernel/Syscalls/ttyname.cpp @@ -11,7 +11,7 @@ namespace Kernel { -KResultOr<int> Process::sys$ttyname(int fd, Userspace<char*> buffer, size_t size) +KResultOr<FlatPtr> Process::sys$ttyname(int fd, Userspace<char*> buffer, size_t size) { REQUIRE_PROMISE(tty); auto description = file_description(fd); @@ -27,7 +27,7 @@ KResultOr<int> Process::sys$ttyname(int fd, Userspace<char*> buffer, size_t size return 0; } -KResultOr<int> Process::sys$ptsname(int fd, Userspace<char*> buffer, size_t size) +KResultOr<FlatPtr> Process::sys$ptsname(int fd, Userspace<char*> buffer, size_t size) { REQUIRE_PROMISE(tty); auto description = file_description(fd); diff --git a/Kernel/Syscalls/umask.cpp b/Kernel/Syscalls/umask.cpp index 0d217e076e..580aec0cc3 100644 --- a/Kernel/Syscalls/umask.cpp +++ b/Kernel/Syscalls/umask.cpp @@ -8,7 +8,7 @@ namespace Kernel { -KResultOr<mode_t> Process::sys$umask(mode_t mask) +KResultOr<FlatPtr> Process::sys$umask(mode_t mask) { REQUIRE_PROMISE(stdio); auto old_mask = m_umask; diff --git a/Kernel/Syscalls/uname.cpp b/Kernel/Syscalls/uname.cpp index 2e65239b60..dc8e002ca0 100644 --- a/Kernel/Syscalls/uname.cpp +++ b/Kernel/Syscalls/uname.cpp @@ -8,7 +8,7 @@ namespace Kernel { -KResultOr<int> Process::sys$uname(Userspace<utsname*> user_buf) +KResultOr<FlatPtr> Process::sys$uname(Userspace<utsname*> user_buf) { extern String* g_hostname; extern Lock* g_hostname_lock; diff --git a/Kernel/Syscalls/unlink.cpp b/Kernel/Syscalls/unlink.cpp index 4eb5f99d35..1586941126 100644 --- a/Kernel/Syscalls/unlink.cpp +++ b/Kernel/Syscalls/unlink.cpp @@ -10,7 +10,7 @@ namespace Kernel { -KResultOr<int> Process::sys$unlink(Userspace<const char*> user_path, size_t path_length) +KResultOr<FlatPtr> Process::sys$unlink(Userspace<const char*> user_path, size_t path_length) { REQUIRE_PROMISE(cpath); auto path = get_syscall_path_argument(user_path, path_length); diff --git a/Kernel/Syscalls/unveil.cpp b/Kernel/Syscalls/unveil.cpp index b76bb9aa62..0cb102ae74 100644 --- a/Kernel/Syscalls/unveil.cpp +++ b/Kernel/Syscalls/unveil.cpp @@ -24,7 +24,7 @@ static void update_intermediate_node_permissions(UnveilNode& root_node, UnveilAc } } -KResultOr<int> Process::sys$unveil(Userspace<const Syscall::SC_unveil_params*> user_params) +KResultOr<FlatPtr> Process::sys$unveil(Userspace<const Syscall::SC_unveil_params*> user_params) { Syscall::SC_unveil_params params; if (!copy_from_user(¶ms, user_params)) diff --git a/Kernel/Syscalls/utime.cpp b/Kernel/Syscalls/utime.cpp index f7ec599339..a5f8b9e80d 100644 --- a/Kernel/Syscalls/utime.cpp +++ b/Kernel/Syscalls/utime.cpp @@ -10,7 +10,7 @@ namespace Kernel { -KResultOr<int> Process::sys$utime(Userspace<const char*> user_path, size_t path_length, Userspace<const struct utimbuf*> user_buf) +KResultOr<FlatPtr> Process::sys$utime(Userspace<const char*> user_path, size_t path_length, Userspace<const struct utimbuf*> user_buf) { REQUIRE_PROMISE(fattr); auto path = get_syscall_path_argument(user_path, path_length); diff --git a/Kernel/Syscalls/waitid.cpp b/Kernel/Syscalls/waitid.cpp index 227876f2d1..828bc9919e 100644 --- a/Kernel/Syscalls/waitid.cpp +++ b/Kernel/Syscalls/waitid.cpp @@ -18,7 +18,7 @@ KResultOr<siginfo_t> Process::do_waitid(idtype_t idtype, int id, int options) return result; } -KResultOr<pid_t> Process::sys$waitid(Userspace<const Syscall::SC_waitid_params*> user_params) +KResultOr<FlatPtr> Process::sys$waitid(Userspace<const Syscall::SC_waitid_params*> user_params) { REQUIRE_PROMISE(proc); diff --git a/Kernel/Syscalls/write.cpp b/Kernel/Syscalls/write.cpp index b2585745dc..fece780d9c 100644 --- a/Kernel/Syscalls/write.cpp +++ b/Kernel/Syscalls/write.cpp @@ -11,7 +11,7 @@ namespace Kernel { -KResultOr<size_t> Process::sys$writev(int fd, Userspace<const struct iovec*> iov, int iov_count) +KResultOr<FlatPtr> Process::sys$writev(int fd, Userspace<const struct iovec*> iov, int iov_count) { REQUIRE_PROMISE(stdio); if (iov_count < 0) @@ -57,7 +57,7 @@ KResultOr<size_t> Process::sys$writev(int fd, Userspace<const struct iovec*> iov return nwritten; } -KResultOr<size_t> Process::do_write(FileDescription& description, const UserOrKernelBuffer& data, size_t data_size) +KResultOr<FlatPtr> Process::do_write(FileDescription& description, const UserOrKernelBuffer& data, size_t data_size) { size_t total_nwritten = 0; @@ -96,7 +96,7 @@ KResultOr<size_t> Process::do_write(FileDescription& description, const UserOrKe return total_nwritten; } -KResultOr<size_t> Process::sys$write(int fd, Userspace<const u8*> data, size_t size) +KResultOr<FlatPtr> Process::sys$write(int fd, Userspace<const u8*> data, size_t size) { REQUIRE_PROMISE(stdio); if (size == 0) |