/* * Copyright (c) 2021, Andreas Kling * Copyright (c) 2021, Kenneth Myhra * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include #include #include #include #include namespace Core::System { #ifdef __serenity__ ErrorOr pledge(StringView promises, StringView execpromises = {}); ErrorOr unveil(StringView path, StringView permissions); ErrorOr> pipe2(int flags); ErrorOr sendfd(int sockfd, int fd); ErrorOr recvfd(int sockfd, int options); ErrorOr ptrace_peekbuf(pid_t tid, void const* tracee_addr, Bytes destination_buf); ErrorOr setgroups(Span); ErrorOr mount(int source_fd, StringView target, StringView fs_type, int flags); ErrorOr ptrace(int request, pid_t tid, void* address, void* data); #endif ErrorOr sigaction(int signal, struct sigaction const* action, struct sigaction* old_action); #ifdef __APPLE__ ErrorOr signal(int signal, sig_t handler); #else ErrorOr signal(int signal, sighandler_t handler); #endif ErrorOr fstat(int fd); ErrorOr fcntl(int fd, int command, ...); ErrorOr mmap(void* address, size_t, int protection, int flags, int fd, off_t, size_t alignment = 0, StringView name = {}); ErrorOr munmap(void* address, size_t); ErrorOr open(StringView path, int options, ...); ErrorOr close(int fd); ErrorOr ftruncate(int fd, off_t length); ErrorOr stat(StringView path); ErrorOr lstat(StringView path); ErrorOr read(int fd, Bytes buffer); ErrorOr write(int fd, ReadonlyBytes buffer); ErrorOr kill(pid_t, int signal); ErrorOr dup(int source_fd); ErrorOr dup2(int source_fd, int destination_fd); ErrorOr ptsname(int fd); ErrorOr gethostname(); ErrorOr getcwd(); ErrorOr ioctl(int fd, unsigned request, ...); ErrorOr tcgetattr(int fd); ErrorOr tcsetattr(int fd, int optional_actions, struct termios const&); ErrorOr chmod(StringView pathname, mode_t mode); ErrorOr chown(StringView pathname, uid_t uid, gid_t gid); ErrorOr getpwnam(StringView name); ErrorOr getgrnam(StringView name); ErrorOr clock_settime(clockid_t clock_id, struct timespec* ts); ErrorOr posix_spawnp(StringView const path, posix_spawn_file_actions_t* const file_actions, posix_spawnattr_t* const attr, char* const arguments[], char* const envp[]); ErrorOr waitpid(pid_t waitee, int* wstatus, int options); ErrorOr setuid(uid_t); ErrorOr seteuid(uid_t); ErrorOr setgid(gid_t); ErrorOr setegid(gid_t); ErrorOr isatty(int fd); ErrorOr symlink(StringView target, StringView link_path); ErrorOr mkdir(StringView path, mode_t); ErrorOr fork(); ErrorOr mkstemp(Span pattern); ErrorOr fchmod(int fd, mode_t mode); ErrorOr rename(StringView old_path, StringView new_path); ErrorOr utime(StringView path, Optional); }