11#if defined(__cplusplus)
36#define STDOUT_FILENO 1
37#define STDERR_FILENO 2
67#define F(format, ...) \
69 char* _buffer = alloca(F_MAX_SIZE); \
70 int _len = snprintf(_buffer, F_MAX_SIZE, format, __VA_ARGS__); \
71 if (_len < 0 || _len >= F_MAX_SIZE) \
212size_t writefiles(
const char* path,
const char*
string);
298#define POLL_SPECIAL (POLLERR | POLLHUP | POLLNVAL)
396static_assert(
sizeof(
stat_t) == 416,
"invalid stat_t size");
579uint64_t mount(
const char* mountpoint,
const char* fs,
const char* options);
613#define RETRY_EINTR(expr) \
619 } while (_result == ERR && errno == EINTR); \
628#define RETRY_EINTR_PTR(expr) \
634 } while (_result == NULL && errno == EINTR); \
640#if defined(__cplusplus)
#define MAX_PATH
Maximum length of filepaths.
EFI_PHYSICAL_ADDRESS buffer
static char format[MAX_NAME]
static clock_source_t source
Structure to describe the HPET to the sys time subsystem.
fd_t dup2(fd_t oldFd, fd_t newFd)
System call for duplicating file descriptors, with a destination.
uint64_t stat(const char *path, stat_t *stat)
System call for retrieving info about a file or directory.
size_t getdents(fd_t fd, dirent_t *buffer, uint64_t count)
System call for reading directory entires.
size_t writefile(const char *path, const void *buffer, size_t count, size_t offset)
Wrapper for writing to a file directly using a path.
fd_t open(const char *path)
System call for opening files.
uint64_t sbid_t
A suberblock identifier that uniquely identifies a superblock within the system.
uint64_t scanfile(const char *path, const char *format,...)
Wrapper for reading from a file path using scan formatting.
char * reads(fd_t fd)
Wrapper for reading a file directly into a null-terminated string.
uint64_t unmount(const char *mountpoint)
System call for unmounting a filesystem.
poll_events_t poll1(fd_t fd, poll_events_t events, clock_t timeout)
Wrapper for polling one file.
size_t writefiles(const char *path, const char *string)
Wrapper for writing a null-terminated string directly to a file using a path.
uint64_t close(fd_t fd)
System call for closing files.
size_t readlink(const char *path, char *buffer, uint64_t count)
System call for reading the target of a symbolic link.
char * readfiles(const char *path)
Wrapper for reading an entire file directly into a null-terminated string.
fd_t dup(fd_t oldFd)
System call for duplicating file descriptors.
uint64_t vscan(fd_t fd, const char *format, va_list args)
Wrapper for reading from a file descriptor using scan formatting with va_list.
size_t write(fd_t fd, const void *buffer, size_t count)
System call for writing to files.
size_t seek(fd_t fd, ssize_t offset, seek_origin_t origin)
System call for changing the file offset.
uint64_t mkdir(const char *path)
Wrapper for creating a directory.
fd_t openat(fd_t from, const char *path)
System call for opening files relative to another file descriptor.
size_t readfile(const char *path, void *buffer, size_t count, size_t offset)
Wrapper for reading a file directly using a path.
uint64_t poll(pollfd_t *fds, uint64_t amount, clock_t timeout)
System call for polling files.
size_t read(fd_t fd, void *buffer, size_t count)
System call for reading from files.
uint64_t chdir(const char *path)
System call for changing the cwd.
dirent_flags_t
Directory entry flags.
uint64_t mount(const char *mountpoint, const char *fs, const char *options)
System call for mounting a filesystem.
fd_t claim(const char *key)
System call for claiming a shared file descriptor.
uint64_t bind(const char *mountpoint, fd_t source)
System call for binding a file descriptor to a mountpoint.
uint64_t symlink(const char *target, const char *linkpath)
System call for creating a symbolic link.
uint64_t vscanfile(const char *path, const char *format, va_list args)
Wrapper for reading from a file path using scan formatting with va_list.
uint64_t unlink(const char *path)
Wrapper for removing a file.
uint8_t seek_origin_t
Type for the seek() origin argument.
poll_events_t
Poll events type.
size_t writes(fd_t fd, const char *string)
Wrapper for writing a null-terminated string to a file.
uint64_t open2(const char *path, fd_t fd[2])
System call for opening 2 file descriptors from one file.
uint64_t scan(fd_t fd, const char *format,...)
Wrapper for reading from a file descriptor using scan formatting.
size_t readdir(fd_t fd, dirent_t **buffer, uint64_t *count)
Helper for reading all directory entries.
uint64_t share(char *key, uint64_t size, fd_t fd, clock_t timeout)
System call for sharing a file descriptor with another process.
uint64_t sharefile(char *key, uint64_t size, const char *path, clock_t timeout)
Helper for sharing a file by its path.
uint64_t rmdir(const char *path)
Wrapper for removing a directory.
uint64_t link(const char *oldPath, const char *newPath)
System call for creating a hardlink.
uint64_t ioctl(fd_t fd, uint64_t request, void *argp, size_t size)
System call for extended driver behaviour.
@ VSYMLINK
Is a symbolic link.
@ DIRENT_MOUNTED
The directory entry is a mountpoint.
@ POLLIN
File descriptor is ready to read.
@ POLLHUP
Stream socket peer closed connection, or shut down writing of connection.
@ POLLNVAL
Invalid file descriptor.
@ POLLOUT
File descriptor is ready to write.
@ POLLERR
File descriptor caused an error.
__INT64_TYPE__ ssize_t
Signed size type.
__UINT64_TYPE__ fd_t
File descriptor type.
__UINT64_TYPE__ clock_t
A nanosecond time.
__builtin_va_list va_list
Poll file descriptor structure.
poll_events_t revents
The events that occurred.
poll_events_t events
The events to wait for.
fd_t fd
The file descriptor to poll.
time_t accessTime
Unix time stamp for the last vnode access.
sbid_t sbid
The superblock ID of the filesystem containing the entry.
uint64_t blockSize
The preferred block size of the filesystem.
uint64_t linkAmount
The amount of times the vnode appears in dentries.
uint64_t size
The size of the file that is visible outside the filesystem.
uint64_t number
The number of the entries vnode.
uint64_t maxFileSize
The maximum size of a file on this filesystem.
time_t modifyTime
Unix time stamp for last file content alteration.
time_t changeTime
Unix time stamp for the last file metadata alteration.
uint64_t blocks
The amount of blocks used on disk to store the file.
vtype_t type
The type of the entries vnode.
time_t createTime
Unix time stamp for the creation of the vnode.
Vnode attributes structure.
long long unsigned time_t