#define SYSCALL_DEFINE(num, returnType,...)
Macro to define a syscall.
fd_t file_table_dup2(file_table_t *table, fd_t oldFd, fd_t newFd)
Duplicate a file descriptor to a specific file descriptor.
uint64_t file_table_free(file_table_t *table, fd_t fd)
Free a file descriptor.
file_t * file_table_get(file_table_t *table, fd_t fd)
Get a file from its file descriptor.
fd_t file_table_alloc(file_table_t *table, file_t *file)
Allocate a new file descriptor for a file.
uint64_t file_table_copy(file_table_t *dest, file_table_t *src, fd_t min, fd_t max)
Copy a file table, closing any overlapping file descriptors.
void file_table_close_all(file_table_t *table)
Close all files in the file table.
void file_table_init(file_table_t *table)
Initialize a file table.
fd_t file_table_set(file_table_t *table, fd_t fd, file_t *file)
Set a specific file descriptor to a file.
void file_table_deinit(file_table_t *table)
Deinitialize a file table.
uint64_t file_table_free_range(file_table_t *table, fd_t min, fd_t max)
Free a range of file descriptors.
fd_t file_table_dup(file_table_t *table, fd_t oldFd)
Duplicate a file descriptor.
process_t * sched_process(void)
Retrieves the process of the currently running thread.
static void lock_init(lock_t *lock)
Initializes a lock.
#define LOCK_SCOPE(lock)
Acquires a lock for the reminder of the current scope.
#define REF(ptr)
Increment reference count.
#define UNREF(ptr)
Decrement reference count.
#define CONFIG_MAX_FD
Maximum file descriptor configuration.
#define EINVAL
Invalid argument.
#define EMFILE
Too many open files.
#define errno
Error number variable.
#define EBADF
Bad file number.
void bitmap_clear(bitmap_t *map, uint64_t index)
Clear a bit in the bitmap.
void bitmap_set(bitmap_t *map, uint64_t index)
Set a bit in the bitmap.
uint64_t bitmap_find_first_clear(bitmap_t *map, uint64_t startIdx, uint64_t endIdx)
Find the first clear bit in the bitmap.
#define BITMAP_DEFINE_INIT(name, bits)
Initialize a bitmap defined with BITMAP_DEFINE.
#define NULL
Pointer error value.
#define ERR
Integer error value.
__UINT64_TYPE__ fd_t
A file descriptor.
file_t * files[CONFIG_MAX_FD]