|
PatchworkOS
|
#include <stdatomic.h>#include <stdint.h>#include "_internal/ERR.h"#include "_internal/NULL.h"#include "_internal/clock_t.h"#include "_internal/config.h"#include "_internal/fd_t.h"#include "_internal/pid_t.h"#include "_internal/tid_t.h"Go to the source code of this file.
Data Structures | |
| struct | spawn_fd_t |
Stucture used to duplicate fds in spawn(). More... | |
| struct | spawn_attr_t |
| struct | sync_t |
| Synchronization object. More... | |
Macros | |
| #define | PRIORITY_MAX 64 |
| #define | PRIORITY_MAX_USER 32 |
| #define | PRIORITY_MIN 0 |
| #define | SPAWN_NONE 0 |
| #define | SPAWN_INHERIT_PRIORITY (1 << 0) |
| #define | SPAWN_FD_END |
| Spawn fds termination constant. | |
| #define | PAGE_SIZE 0x1000 |
| Memory page size. | |
| #define | BYTES_TO_PAGES(amount) (((amount) + PAGE_SIZE - 1) / PAGE_SIZE) |
| Convert bytes to pages. | |
| #define | PAGE_SIZE_OF(object) BYTES_TO_PAGES(sizeof(object)) |
| Size of an object in pages. | |
| #define | FUTEX_ALL UINT64_MAX |
| Futex wake all constant. | |
Typedefs | |
| typedef uint8_t | priority_t |
| Priority type. | |
| typedef uint64_t | spawn_flags_t |
| Spawn behaviour flags. | |
Enumerations | |
| enum | prot_t { PROT_NONE = 0 , PROT_READ = (1 << 0) , PROT_WRITE = (1 << 1) } |
| Memory protection flags. More... | |
| enum | futex_op_t { FUTEX_WAIT , FUTEX_WAKE } |
| Futex operation enum. More... | |
Functions | |
| pid_t | spawn (const char **argv, const spawn_fd_t *fds, const char *cwd, spawn_attr_t *attr) |
| System call for creating child processes. | |
| pid_t | getpid (void) |
| System call to retrieve the current pid. | |
| tid_t | gettid (void) |
| System call to retrieve the current tid. | |
| void * | mmap (fd_t fd, void *address, uint64_t length, prot_t prot) |
| System call to map memory from a file. | |
| uint64_t | munmap (void *address, uint64_t length) |
| System call to unmap mapped memory. | |
| uint64_t | mprotect (void *address, uint64_t length, prot_t prot) |
| System call to change the protection flags of memory. | |
| 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. | |
| clock_t | uptime (void) |
| System call for retreving the time since boot. | |
| uint64_t | nanosleep (clock_t timeout) |
| System call for sleeping. | |