9#if defined(__cplusplus)
47#define STDOUT_FILENO 1
48#define STDERR_FILENO 2
83#define F(format, ...) \
85 char* _buffer = alloca(F_MAX_SIZE); \
86 int _len = snprintf(_buffer, F_MAX_SIZE, format, __VA_ARGS__); \
87 assert(_len >= 0 && "F() formatting error"); \
269#define POLL_SPECIAL (POLLERR | POLLHUP | POLLNVAL)
344static_assert(
sizeof(
stat_t) == 168,
"invalid stat_t size");
507#if defined(__cplusplus)
#define MAX_NAME
Maximum length of names.
#define MAX_PATH
Maximum length of filepaths.
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.
uint64_t getdents(fd_t fd, dirent_t *buffer, uint64_t count)
System call for reading directory entires.
#define KEY_SIZE
Size of keys in bytes.
fd_t open(const char *path)
System call for opening files.
mount_flags_t
Mount flags type.
inode_type_t
Inode type enum.
fd_t claim(key_t *key)
System call for claiming a shared file descriptor.
poll_events_t poll1(fd_t fd, poll_events_t events, clock_t timeout)
Wrapper for polling one file.
uint64_t inode_number_t
Inode number enum.
uint64_t close(fd_t fd)
System call for closing files.
uint64_t swrite(fd_t fd, const char *string)
Wrapper for writing a null-terminated string to a file.
uint64_t seek(fd_t fd, int64_t offset, seek_origin_t origin)
System call for changing the file offset.
uint64_t ioctl(fd_t fd, uint64_t request, void *argp, uint64_t size)
System call for extended driver behaviour.
fd_t dup(fd_t oldFd)
System call for duplicating file descriptors.
uint64_t mkdir(const char *path)
Wrapper for creating a directory.
uint64_t swritefile(const char *path, const char *string)
Wrapper for writing a null-terminated string directly to a file using a path.
fd_t openat(fd_t from, const char *path)
System call for opening files relative to another file descriptor.
uint64_t readfile(const char *path, void *buffer, uint64_t count, uint64_t offset)
Wrapper for reading a file directly using a path.
uint64_t bind(fd_t source, const char *mountpoint, mount_flags_t flags)
System call for binding a file descriptor to a mountpoint.
uint64_t poll(pollfd_t *fds, uint64_t amount, clock_t timeout)
System call for polling files.
uint64_t chdir(const char *path)
System call for changing the cwd.
uint64_t unlink(const char *path)
Wrapper for removing a file.
uint8_t seek_origin_t
Type for the seek() origin argument.
uint64_t read(fd_t fd, void *buffer, uint64_t count)
System call for reading from files.
poll_events_t
Poll events type.
char * sread(fd_t fd)
Wrapper for reading a file directly into a null-terminated string.
char * sreadfile(const char *path)
Wrapper for reading an entire file directly into a null-terminated string.
uint64_t open2(const char *path, fd_t fd[2])
System call for opening 2 file descriptors from one file.
uint64_t share(key_t *key, fd_t fd, clock_t timeout)
System call for sharing a file descriptor with another process.
uint64_t write(fd_t fd, const void *buffer, uint64_t count)
System call for writing to files.
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 writefile(const char *path, const void *buffer, uint64_t count, uint64_t offset)
Wrapper for writing to a file directly using a path.
@ MOUNT_NONE
No special mount flags.
@ MOUNT_PROPAGATE_PARENT
Propagate the mount to parent namespaces.
@ MOUNT_OVERWRITE
Overwrite any existing mount at the mountpoint.
@ MOUNT_PROPAGATE_CHILDREN
Propagate the mount to child namespaces.
@ INODE_DIR
Is a directory.
@ 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.
__UINT64_TYPE__ fd_t
A file descriptor.
__UINT64_TYPE__ clock_t
A nanosecond time.
static clock_source_t source
Structure to describe the HPET to the sys time subsystem.
EFI_PHYSICAL_ADDRESS buffer
static const path_flag_t flags[]
inode_type_t type
The type of the entries inode.
inode_number_t number
The number of the entries inode.
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 inode access.
uint64_t linkAmount
The amount of times the inode appears in dentries.
inode_number_t number
The number of the entries inode.
uint64_t size
The size of the file that is visible outside the filesystem.
inode_type_t type
The type of the entries inode.
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.
time_t createTime
Unix time stamp for the creation of the inode.
long long unsigned time_t