2021-11-22 11:43:57 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
2021-11-27 11:23:16 -03:00
|
|
|
* Copyright (c) 2021, Kenneth Myhra <kennethmyhra@gmail.com>
|
2021-11-22 11:43:57 -03:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <AK/Error.h>
|
2021-12-06 17:24:18 -03:00
|
|
|
#include <grp.h>
|
2021-11-29 18:03:19 -03:00
|
|
|
#include <pwd.h>
|
2021-11-22 12:11:03 -03:00
|
|
|
#include <signal.h>
|
2021-11-23 07:10:19 -03:00
|
|
|
#include <sys/stat.h>
|
2021-11-29 19:28:10 -03:00
|
|
|
#include <termios.h>
|
2021-11-27 18:01:40 -03:00
|
|
|
#include <time.h>
|
2021-11-22 11:43:57 -03:00
|
|
|
|
2021-11-23 06:59:50 -03:00
|
|
|
namespace Core::System {
|
2021-11-22 11:43:57 -03:00
|
|
|
|
2021-11-23 06:59:50 -03:00
|
|
|
#ifdef __serenity__
|
2021-11-27 19:23:58 -03:00
|
|
|
ErrorOr<void> pledge(StringView promises, StringView execpromises = {});
|
2021-11-22 11:43:57 -03:00
|
|
|
ErrorOr<void> unveil(StringView path, StringView permissions);
|
2021-11-24 18:36:13 -03:00
|
|
|
ErrorOr<Array<int, 2>> pipe2(int flags);
|
2021-11-28 05:12:29 -03:00
|
|
|
ErrorOr<void> sendfd(int sockfd, int fd);
|
|
|
|
|
ErrorOr<int> recvfd(int sockfd, int options);
|
2021-11-25 19:04:52 -03:00
|
|
|
ErrorOr<void> ptrace_peekbuf(pid_t tid, void const* tracee_addr, Bytes destination_buf);
|
2021-11-23 06:59:50 -03:00
|
|
|
#endif
|
|
|
|
|
|
2021-11-22 12:11:03 -03:00
|
|
|
ErrorOr<void> sigaction(int signal, struct sigaction const* action, struct sigaction* old_action);
|
2021-11-23 07:10:19 -03:00
|
|
|
ErrorOr<struct stat> fstat(int fd);
|
|
|
|
|
ErrorOr<int> fcntl(int fd, int command, ...);
|
2021-11-23 07:47:32 -03:00
|
|
|
ErrorOr<void*> mmap(void* address, size_t, int protection, int flags, int fd, off_t, size_t alignment = 0, StringView name = {});
|
2021-11-23 07:51:11 -03:00
|
|
|
ErrorOr<void> munmap(void* address, size_t);
|
2021-11-23 07:59:16 -03:00
|
|
|
ErrorOr<int> open(StringView path, int options, ...);
|
2021-11-23 08:05:56 -03:00
|
|
|
ErrorOr<void> close(int fd);
|
2021-11-23 08:16:07 -03:00
|
|
|
ErrorOr<void> ftruncate(int fd, off_t length);
|
2021-11-23 08:22:21 -03:00
|
|
|
ErrorOr<struct stat> stat(StringView path);
|
2021-12-02 18:41:40 -03:00
|
|
|
ErrorOr<struct stat> lstat(StringView path);
|
2021-11-27 18:02:33 -03:00
|
|
|
ErrorOr<ssize_t> read(int fd, Bytes buffer);
|
|
|
|
|
ErrorOr<ssize_t> write(int fd, ReadonlyBytes buffer);
|
2021-11-23 12:06:56 -03:00
|
|
|
ErrorOr<void> kill(pid_t, int signal);
|
2021-11-28 08:08:28 -03:00
|
|
|
ErrorOr<int> dup(int source_fd);
|
2021-11-24 18:36:28 -03:00
|
|
|
ErrorOr<int> dup2(int source_fd, int destination_fd);
|
2021-11-24 19:24:53 -03:00
|
|
|
ErrorOr<String> ptsname(int fd);
|
2021-11-27 06:13:33 -03:00
|
|
|
ErrorOr<String> gethostname();
|
2021-11-29 19:07:33 -03:00
|
|
|
ErrorOr<void> ioctl(int fd, unsigned request, ...);
|
2021-11-29 19:28:10 -03:00
|
|
|
ErrorOr<struct termios> tcgetattr(int fd);
|
|
|
|
|
ErrorOr<void> tcsetattr(int fd, int optional_actions, struct termios const&);
|
2021-11-27 11:46:11 -03:00
|
|
|
ErrorOr<void> chmod(StringView pathname, mode_t mode);
|
2021-11-27 11:23:16 -03:00
|
|
|
ErrorOr<void> chown(StringView pathname, uid_t uid, gid_t gid);
|
2021-11-29 18:03:19 -03:00
|
|
|
ErrorOr<struct passwd> getpwnam(StringView name);
|
2021-12-06 17:24:18 -03:00
|
|
|
ErrorOr<struct group> getgrnam(StringView name);
|
2021-11-27 18:01:40 -03:00
|
|
|
ErrorOr<void> clock_settime(clockid_t clock_id, struct timespec* ts);
|
2021-11-22 11:43:57 -03:00
|
|
|
|
|
|
|
|
}
|