/* * Copyright (c) 2021, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #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); #endif ErrorOr sigaction(int signal, struct sigaction const* action, struct sigaction* old_action); 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 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); }