dius 0.1.0
Loading...
Searching...
No Matches
syscalls.h
Go to the documentation of this file.
1#pragma once
2
3#include "di/container/path/path.h"
4#include "di/container/path/path_view.h"
5#include "di/vocab/error/prelude.h"
6#include "di/vocab/expected/prelude.h"
7#include "di/vocab/span/prelude.h"
8#include "dius/c_definitions.h"
9#include "dius/platform_process.h"
10
11namespace dius::syscalls {
12template<typename T = void>
13using Result = di::Expected<T, di::GenericCode>;
14
15auto sys_read(int fd, di::Span<byte> data) -> Result<usize>;
16auto sys_write(int fd, di::Span<byte const> data) -> Result<usize>;
17auto sys_pread(int fd, u64 offset, di::Span<byte> data) -> Result<usize>;
18auto sys_pwrite(int fd, u64 offset, di::Span<byte const> data) -> Result<usize>;
19auto sys_close(int fd) -> Result<>;
20auto sys_dup2(int old_fd, int new_fd) -> Result<>;
21
22auto sys_open(di::PathView path, int flags, u16 create_mode) -> Result<int>;
23auto sys_ftruncate(int fd, u64 size) -> Result<>;
24
25auto sys_munmap(byte* data, usize length) -> Result<>;
26auto sys_mmap(void* addr, usize length, int prot, int flags, int fd, u64 offset) -> Result<byte*>;
27
28auto sys_ioctl(int fd, unsigned long code, void* arg) -> Result<>;
29
32auto sys_execve(char const* path, char** args, char** env) -> Result<>;
33
35auto sys_grantpt(int fd) -> Result<>;
36auto sys_unlockpt(int fd) -> Result<>;
38auto sys_tcsetattr(int fd, termios const& termios) -> Result<>;
39
40auto sys_mkdir(di::PathView path, u32 perms) -> Result<>;
41auto sys_mknod(di::PathView path, u32 type, u32 perms) -> Result<>;
42
43auto sys_stat(di::PathView path) -> Result<Stat>;
44auto sys_lstat(di::PathView path) -> Result<Stat>;
45
46auto sys_clock_nanosleep(int clock, int flags, timespec timespec) -> Result<::timespec>;
47}
Definition c_definitions.h:20
auto sys_munmap(byte *data, usize length) -> Result<>
auto sys_tcsetattr(int fd, termios const &termios) -> Result<>
auto sys_fork() -> Result< ProcessId >
auto sys_mkdir(di::PathView path, u32 perms) -> Result<>
auto sys_write(int fd, di::Span< byte const > data) -> Result< usize >
auto sys_open(di::PathView path, int flags, u16 create_mode) -> Result< int >
auto sys_close(int fd) -> Result<>
auto sys_pwrite(int fd, u64 offset, di::Span< byte const > data) -> Result< usize >
auto sys_ioctl(int fd, unsigned long code, void *arg) -> Result<>
auto sys_lstat(di::PathView path) -> Result< Stat >
auto sys_mmap(void *addr, usize length, int prot, int flags, int fd, u64 offset) -> Result< byte * >
auto sys_setsid() -> Result<>
auto sys_unlockpt(int fd) -> Result<>
auto sys_pread(int fd, u64 offset, di::Span< byte > data) -> Result< usize >
auto sys_execve(char const *path, char **args, char **env) -> Result<>
auto sys_tcgetattr(int fd) -> Result< termios >
auto sys_mknod(di::PathView path, u32 type, u32 perms) -> Result<>
auto sys_read(int fd, di::Span< byte > data) -> Result< usize >
di::Expected< T, di::GenericCode > Result
Definition syscalls.h:13
auto sys_grantpt(int fd) -> Result<>
auto sys_clock_nanosleep(int clock, int flags, timespec timespec) -> Result<::timespec >
auto sys_ftruncate(int fd, u64 size) -> Result<>
auto sys_dup2(int old_fd, int new_fd) -> Result<>
auto sys_ptsname(int fd) -> Result< di::Path >
auto sys_stat(di::PathView path) -> Result< Stat >