#define SYSCALL_DEFINE(num, returnType,...)
Macro to define a syscall.
uint64_t thread_load_atomic_from_user(thread_t *thread, atomic_uint64_t *userObj, uint64_t *outValue)
Atomically load a 64-bit value from a user-space atomic variable.
uint64_t wait_block_prepare(wait_queue_t **waitQueues, uint64_t amount, clock_t timeout)
Prepare to block the currently running thread.
uint64_t wait_unblock(wait_queue_t *queue, uint64_t amount, errno_t err)
Unblock threads waiting on a wait queue.
uint64_t wait_block_commit(void)
Block the currently running thread.
void wait_block_cancel(void)
Cancels blocking of the currently running thread.
void wait_queue_deinit(wait_queue_t *queue)
Deinitialize wait queue.
void wait_queue_init(wait_queue_t *queue)
Initialize wait queue.
thread_t * sched_thread(void)
Retrieves the currently running thread.
void futex_ctx_deinit(futex_ctx_t *ctx)
Deinitialize a per-process futex context. *.
void futex_ctx_init(futex_ctx_t *ctx)
Initialize a per-process futex context.
static void lock_init(lock_t *lock)
Initializes a lock.
#define LOCK_SCOPE(lock)
Acquires a lock for the reminder of the current scope.
void map_init(map_t *map)
Initialize a map.
void map_deinit(map_t *map)
Deinitialize a map.
void map_entry_init(map_entry_t *entry)
Initialize a map entry.
static map_key_t map_key_uint64(uint64_t uint64)
Create a map key from a uint64_t.
uint64_t map_insert(map_t *map, const map_key_t *key, map_entry_t *value)
Insert a key-value pair into the map.
#define MAP_ENTRY_PTR_IS_VALID(entryPtr)
Check if a map entry pointer is valid (not NULL or tombstone).
map_entry_t * map_get(map_t *map, const map_key_t *key)
Get a value from the map by key.
#define EINVAL
Invalid argument.
#define errno
Error number variable.
futex_op_t
Futex operation enum.
uint64_t futex(atomic_uint64_t *addr, uint64_t val, futex_op_t op, clock_t timeout)
System call for fast user space mutual exclusion.
@ FUTEX_WAKE
Wake up one or more threads waiting on the futex.
@ FUTEX_WAIT
Wait until the timeout expires or the futex value changes.
#define NULL
Pointer error value.
#define ERR
Integer error value.
#define CONTAINER_OF(ptr, type, member)
Container of macro.
#define CONTAINER_OF_SAFE(ptr, type, member)
Safe container of macro.
__UINT64_TYPE__ clock_t
A nanosecond time.
static futex_t * futex_ctx_get(futex_ctx_t *ctx, void *addr)
_PUBLIC void * malloc(size_t size)
_PUBLIC void free(void *ptr)
Per-process futex context.
Thread of execution structure.
process_t * process
The parent process that the thread executes within.
The primitive that threads block on.