more stuff
This commit is contained in:
@@ -1,36 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
typedef enum memory_order {
|
||||
memory_order_relaxed = __ATOMIC_RELAXED,
|
||||
memory_order_consume = __ATOMIC_CONSUME,
|
||||
memory_order_acquire = __ATOMIC_ACQUIRE,
|
||||
memory_order_release = __ATOMIC_RELEASE,
|
||||
memory_order_acq_rel = __ATOMIC_ACQ_REL,
|
||||
memory_order_seq_cst = __ATOMIC_SEQ_CST
|
||||
} memory_order;
|
||||
|
||||
#define atomic_store_explicit(ptr, des, ord) __atomic_store_n(ptr, des, ord)
|
||||
#define atomic_store(ptr, des) atomic_store_explicit(ptr, des, __ATOMIC_SEQ_CST)
|
||||
|
||||
#define atomic_load_explicit(ptr, ord) __atomic_load_n(ptr, ord)
|
||||
#define atomic_load(ptr) atomic_load_explicit(ptr, __ATOMIC_SEQ_CST)
|
||||
|
||||
#define atomic_exchange_explicit(ptr, des, ord) __atomic_exchange_n(ptr, des, ord)
|
||||
#define atomic_exchange(ptr, des) atomic_exchange_explicit(ptr, des, __ATOMIC_SEQ_CST)
|
||||
|
||||
#define atomic_fetch_add_explicit(ptr, op, ord) __atomic_fetch_add(ptr, op, ord)
|
||||
#define atomic_fetch_add(ptr, op) atomic_fetch_add_explicit(ptr, op, __ATOMIC_SEQ_CST)
|
||||
|
||||
#define atomic_fetch_sub_explicit(ptr, op, ord) __atomic_fetch_sub(ptr, op, ord)
|
||||
#define atomic_fetch_sub(ptr, op) atomic_fetch_sub_explicit(ptr, op, __ATOMIC_SEQ_CST)
|
||||
|
||||
#define atomic_fetch_or_explicit(ptr, op, ord) __atomic_fetch_or(ptr, op, ord)
|
||||
#define atomic_fetch_or(ptr, op) atomic_fetch_or_explicit(ptr, op, __ATOMIC_SEQ_CST)
|
||||
|
||||
#define atomic_fetch_xor_explicit(ptr, op, ord) __atomic_fetch_xor(ptr, op, ord)
|
||||
#define atomic_fetch_xor(ptr, op) atomic_fetch_xor_explicit(ptr, op, __ATOMIC_SEQ_CST)
|
||||
|
||||
#define atomic_fetch_and_explicit(ptr, op, ord) __atomic_fetch_and(ptr, op, ord)
|
||||
#define atomic_fetch_and(ptr, op) atomic_fetch_and_explicit(ptr, op, __ATOMIC_SEQ_CST)
|
||||
|
||||
#define atomic_thread_fence(ord) __atomic_thread_fence(ord)
|
||||
+6
-2
@@ -1,4 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
long atol(const char* str, int base);
|
||||
unsigned long atolu(const char* str, int base);
|
||||
#include <stdint.h>
|
||||
|
||||
int64_t atol(const char* str, int base);
|
||||
uint64_t atolu(const char* str, int base);
|
||||
char* lutoa(uint64_t value, char* str, int base);
|
||||
char* ltoa(int64_t value, char* str, int base);
|
||||
|
||||
@@ -31,7 +31,7 @@ union __epoll_data {
|
||||
uint64_t u64;
|
||||
};
|
||||
|
||||
struct epoll_event {
|
||||
struct __epoll_event {
|
||||
uint32_t events;
|
||||
union __epoll_data data;
|
||||
};
|
||||
|
||||
+13
-13
@@ -33,19 +33,19 @@
|
||||
#define __S_IEXEC __S_IXUSR
|
||||
|
||||
struct __stat {
|
||||
dev_t st_dev;
|
||||
ino_t st_ino;
|
||||
mode_t st_mode;
|
||||
nlink_t st_nlink;
|
||||
uid_t st_uid;
|
||||
gid_t st_gid;
|
||||
dev_t st_rdev;
|
||||
off_t st_size;
|
||||
struct timespec st_atim;
|
||||
struct timespec st_mtim;
|
||||
struct timespec st_ctim;
|
||||
blksize_t st_blksize;
|
||||
blkcnt_t st_blocks;
|
||||
__dev_t st_dev;
|
||||
__ino_t st_ino;
|
||||
__mode_t st_mode;
|
||||
__nlink_t st_nlink;
|
||||
__uid_t st_uid;
|
||||
__gid_t st_gid;
|
||||
__dev_t st_rdev;
|
||||
__off_t st_size;
|
||||
struct __timespec st_atim;
|
||||
struct __timespec st_mtim;
|
||||
struct __timespec st_ctim;
|
||||
__blksize_t st_blksize;
|
||||
__blkcnt_t st_blocks;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+11
-11
@@ -4,27 +4,27 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef int64_t time_t;
|
||||
typedef int64_t suseconds_t;
|
||||
typedef int64_t __time_t;
|
||||
typedef int64_t __suseconds_t;
|
||||
|
||||
struct timespec {
|
||||
time_t tv_sec;
|
||||
struct __timespec {
|
||||
__time_t tv_sec;
|
||||
int64_t tv_nsec;
|
||||
};
|
||||
|
||||
struct timeval {
|
||||
time_t tv_sec;
|
||||
suseconds_t tv_usec;
|
||||
struct __timeval {
|
||||
__time_t tv_sec;
|
||||
__suseconds_t tv_usec;
|
||||
};
|
||||
|
||||
struct itimerval {
|
||||
struct timeval it_interval;
|
||||
struct timeval it_value;
|
||||
struct __timeval it_interval;
|
||||
struct __timeval it_value;
|
||||
};
|
||||
|
||||
struct itimerspec {
|
||||
struct timespec it_interval;
|
||||
struct timespec it_value;
|
||||
struct __timespec it_interval;
|
||||
struct __timespec it_value;
|
||||
};
|
||||
|
||||
#define __ITIMER_REAL 0
|
||||
|
||||
+16
-16
@@ -4,21 +4,21 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef int64_t off_t;
|
||||
typedef off_t off64_t;
|
||||
typedef uintptr_t blksize_t;
|
||||
typedef uintptr_t blkcnt_t;
|
||||
typedef uintptr_t clockid_t;
|
||||
typedef uintptr_t dev_t;
|
||||
typedef uint32_t gid_t;
|
||||
typedef uintptr_t ino_t;
|
||||
typedef uint32_t mode_t;
|
||||
typedef uintptr_t nlink_t;
|
||||
typedef int32_t pid_t;
|
||||
typedef uintptr_t rlim_t;
|
||||
typedef uint32_t uid_t;
|
||||
typedef uintptr_t fsblkcnt_t;
|
||||
typedef uintptr_t fsfilcnt_t;
|
||||
typedef uintptr_t pthread_attr_t;
|
||||
typedef int64_t __off_t;
|
||||
typedef __off_t __off64_t;
|
||||
typedef uintptr_t __blksize_t;
|
||||
typedef uintptr_t __blkcnt_t;
|
||||
typedef uintptr_t __clockid_t;
|
||||
typedef uintptr_t __dev_t;
|
||||
typedef uint32_t __gid_t;
|
||||
typedef uintptr_t __ino_t;
|
||||
typedef uint32_t __mode_t;
|
||||
typedef uintptr_t __nlink_t;
|
||||
typedef int32_t __pid_t;
|
||||
typedef uintptr_t __rlim_t;
|
||||
typedef uint32_t __uid_t;
|
||||
typedef uintptr_t __fsblkcnt_t;
|
||||
typedef uintptr_t __fsfilcnt_t;
|
||||
typedef uintptr_t __pthread_attr_t;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
typedef enum memory_order {
|
||||
ATOMIC_RELAXED = __ATOMIC_RELAXED,
|
||||
ATOMIC_CONSUME = __ATOMIC_CONSUME,
|
||||
ATOMIC_ACQUIRE = __ATOMIC_ACQUIRE,
|
||||
ATOMIC_RELEASE = __ATOMIC_RELEASE,
|
||||
ATOMIC_ACQ_REL = __ATOMIC_ACQ_REL,
|
||||
ATOMIC_SEQ_CST = __ATOMIC_SEQ_CST
|
||||
} memory_order;
|
||||
|
||||
#define atomic(T) _Atomic(T)
|
||||
|
||||
#define atomic_store(ptr, des, order) __atomic_store_n(ptr, des, order)
|
||||
|
||||
#define atomic_load(ptr, order) __atomic_load_n(ptr, order)
|
||||
|
||||
#define atomic_exchange(ptr, des, order) __atomic_exchange_n(ptr, des, order)
|
||||
|
||||
#define atomic_fetch_add(ptr, op, order) __atomic_fetch_add(ptr, op, order)
|
||||
|
||||
#define atomic_fetch_sub(ptr, op, order) __atomic_fetch_sub(ptr, op, order)
|
||||
|
||||
#define atomic_fetch_or(ptr, op, order) __atomic_fetch_or(ptr, op, order)
|
||||
|
||||
#define atomic_fetch_xor(ptr, op, order) __atomic_fetch_xor(ptr, op, order)
|
||||
|
||||
#define atomic_fetch_and(ptr, op, order) __atomic_fetch_and(ptr, op, order)
|
||||
|
||||
#define atomic_thread_fence(order) __atomic_thread_fence(order)
|
||||
@@ -1 +0,0 @@
|
||||
#pragma once
|
||||
@@ -1,12 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <zinnia/compiler.h>
|
||||
#include <zinnia/utils.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define _CMDLINE_OPTION(x, opt_name, opt_func) \
|
||||
#define _CMDLINE_OPTION(x, opt_name, opt_desc, opt_func, opt_limit) \
|
||||
static const struct cmdline_option x = { \
|
||||
.name = opt_name, \
|
||||
.desc = opt_desc, \
|
||||
.option_type = _Generic( \
|
||||
(opt_func), \
|
||||
void (*)(const char*): CMDLINE_STRING, \
|
||||
@@ -15,11 +16,23 @@
|
||||
void (*)(uintptr_t): CMDLINE_UINTPTR \
|
||||
), \
|
||||
.func = (void*)(opt_func), \
|
||||
.limit = (void*)(opt_limit) \
|
||||
}; \
|
||||
static_assert(_Generic( \
|
||||
(opt_limit), \
|
||||
const char**: true, \
|
||||
const struct cmdline_option_limit_int*: true, \
|
||||
const struct cmdline_option_limit_uint*: true, \
|
||||
void*: true \
|
||||
)); \
|
||||
[[__used, __section(".cmdline")]] \
|
||||
static const struct cmdline_option* CONCAT(x, _ptr) = &x;
|
||||
static const struct cmdline_option* CONCAT(x, _ptr) = &x
|
||||
|
||||
#define CMDLINE_OPTION(opt_name, opt_func) _CMDLINE_OPTION(UNIQUE_IDENT(cmdline_option), opt_name, opt_func)
|
||||
#define CMDLINE_OPTION(opt_name, opt_desc, opt_func) \
|
||||
_CMDLINE_OPTION(UNIQUE_IDENT(cmdline_option), opt_name, opt_desc, opt_func, (void*)nullptr)
|
||||
|
||||
#define CMDLINE_OPTION_RANGE(opt_name, opt_desc, opt_func, opt_values) \
|
||||
_CMDLINE_OPTION(UNIQUE_IDENT(cmdline_option), opt_name, opt_desc, opt_func, opt_values)
|
||||
|
||||
enum cmdline_type {
|
||||
CMDLINE_STRING,
|
||||
@@ -28,9 +41,12 @@ enum cmdline_type {
|
||||
CMDLINE_UINTPTR,
|
||||
};
|
||||
|
||||
// Describes a command line option.
|
||||
// NOTE: Changing the layout of this struct requires changes in util scripts.
|
||||
struct cmdline_option {
|
||||
// The name of this option.
|
||||
const char* name;
|
||||
const char* desc;
|
||||
enum cmdline_type option_type;
|
||||
// Gets called if this option is present on the command line.
|
||||
union {
|
||||
void (*func_str)(const char* value);
|
||||
@@ -39,8 +55,28 @@ struct cmdline_option {
|
||||
void (*func_uintptr)(uintptr_t value);
|
||||
void* func;
|
||||
};
|
||||
enum cmdline_type option_type;
|
||||
union {
|
||||
const char** str_limit;
|
||||
struct cmdline_option_limit_int {
|
||||
intptr_t min, max;
|
||||
}* intptr_limit;
|
||||
struct cmdline_option_limit_uint {
|
||||
uintptr_t min, max;
|
||||
}* uintptr_limit;
|
||||
void* limit;
|
||||
};
|
||||
};
|
||||
|
||||
// Parses the command line and invokes all options.
|
||||
void cmdline_parse(const char* cmdline);
|
||||
|
||||
static_assert(
|
||||
0 ==
|
||||
_Generic(
|
||||
(cmdline_parse),
|
||||
void (*)(const char*): CMDLINE_STRING,
|
||||
void (*)(bool): CMDLINE_BOOL,
|
||||
void (*)(intptr_t): CMDLINE_INTPTR,
|
||||
void (*)(uintptr_t): CMDLINE_UINTPTR
|
||||
)
|
||||
);
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <zinnia/compiler.h>
|
||||
#include <zinnia/utils.h>
|
||||
#include <stddef.h>
|
||||
|
||||
struct console {
|
||||
const char* name;
|
||||
void* private;
|
||||
|
||||
// Initializes the console.
|
||||
bool (*init)(struct console* con);
|
||||
// Writes to the console.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <uapi/errno.h>
|
||||
|
||||
typedef enum : int32_t {
|
||||
EOK = 0, // Not really an error.
|
||||
EOK = 0, // Success! Not really an error though...
|
||||
EPERM = __EPERM,
|
||||
ENOENT = __ENOENT,
|
||||
ESRCH = __ESRCH,
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
struct file_desc {};
|
||||
@@ -1,17 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <zinnia/compiler.h>
|
||||
#include <zinnia/errno.h>
|
||||
#include <zinnia/wait.h>
|
||||
|
||||
struct futex {};
|
||||
|
||||
// Initializes the global futex table.
|
||||
void futex_init(void);
|
||||
|
||||
// Blocks the calling task if *addr == expected.
|
||||
errno_t futex_wait(__user int* addr, int expected);
|
||||
|
||||
// Wakes up to `count` tasks waiting on the given address.
|
||||
// Returns the number of tasks woken.
|
||||
errno_t futex_wake(__user int* addr, int count);
|
||||
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
struct ident {
|
||||
// TODO
|
||||
};
|
||||
+10
-8
@@ -9,16 +9,18 @@
|
||||
|
||||
ASSERT_TYPE(struct arch_percpu); // bits/percpu.h
|
||||
|
||||
#define __percpu __used, __section(".percpu")
|
||||
|
||||
// CPU-relative information.
|
||||
struct percpu {
|
||||
struct percpu* self; // A pointer to this structure.
|
||||
size_t id; // The virtual ID of this CPU.
|
||||
bool online; // Whether this CPU is initialized and active.
|
||||
uintptr_t kernel_stack; // The kernel mode stack.
|
||||
uintptr_t user_stack; // The user mode stack.
|
||||
struct arch_percpu arch; // Architecture-specific fields.
|
||||
struct irq_percpu irq; // IRQ information.
|
||||
struct sched_percpu sched; // Scheduler information.
|
||||
struct percpu* self; // A pointer to this structure.
|
||||
size_t id; // The virtual ID of this CPU.
|
||||
bool online; // Whether this CPU is initialized and active.
|
||||
uintptr_t kernel_stack; // The kernel mode stack.
|
||||
uintptr_t user_stack; // The user mode stack.
|
||||
struct arch_percpu arch; // Architecture-specific fields.
|
||||
struct irq_percpu irq; // IRQ information.
|
||||
struct scheduler sched; // Scheduler information.
|
||||
};
|
||||
|
||||
struct percpu* percpu_new();
|
||||
|
||||
@@ -24,7 +24,7 @@ enum cache_mode : uint8_t {
|
||||
|
||||
struct pmap {
|
||||
phys_t root;
|
||||
spinlock_t lock;
|
||||
struct spinlock lock;
|
||||
bool is_user;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <zinnia/list.h>
|
||||
#include <stdint.h>
|
||||
#include <uapi/poll.h>
|
||||
|
||||
@@ -16,3 +17,8 @@ enum poll_flags : uint16_t {
|
||||
POLLWRNORM = __POLLWRNORM,
|
||||
POLLWRBAND = __POLLWRBAND,
|
||||
};
|
||||
|
||||
struct poll_event {
|
||||
// TODO
|
||||
list_link(struct poll_event*) next;
|
||||
};
|
||||
|
||||
@@ -9,10 +9,12 @@ void kprintf(const char* message, ...);
|
||||
void kvprintf(const char* message, va_list args);
|
||||
|
||||
#include <zinnia/clock.h>
|
||||
#include <stdint.h>
|
||||
#include <zinnia/percpu.h>
|
||||
|
||||
#define log(category, message, ...) \
|
||||
#define log(message, ...) \
|
||||
do { \
|
||||
uint64_t _time = clock_get_elapsed_ns(); \
|
||||
kprintf("[%5lu.%06lu] \e[1;34m" category ":\e[0m " message, _time / 1'000'000'000, _time % 1'000'000, ##__VA_ARGS__); \
|
||||
auto _time = clock_get_elapsed_ns(); \
|
||||
auto _cur = percpu_get()->sched.current; \
|
||||
auto _tid = _cur ? _cur->id : 0; \
|
||||
kprintf("[%5lu.%06lu] [%5lu] " message, _time / 1'000'000'000, _time % 1'000'000, _tid, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <zinnia/atomic.h>
|
||||
#include <zinnia/utils.h>
|
||||
#include <stddef.h>
|
||||
|
||||
struct refcount {
|
||||
size_t count;
|
||||
atomic(size_t) count;
|
||||
};
|
||||
|
||||
void refcount_inc(struct refcount* rc);
|
||||
|
||||
+7
-17
@@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <zinnia/atomic.h>
|
||||
#include <zinnia/errno.h>
|
||||
#include <zinnia/init.h>
|
||||
#include <zinnia/tailq.h>
|
||||
#include <zinnia/types.h>
|
||||
#include <zinnia/wait.h>
|
||||
#include <bits/sched.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
@@ -39,39 +39,29 @@ struct task {
|
||||
};
|
||||
|
||||
// Per-CPU data for scheduling.
|
||||
struct sched_percpu {
|
||||
struct scheduler {
|
||||
struct task* current;
|
||||
struct task* idle_task;
|
||||
size_t preempt_level;
|
||||
tailq_head(struct task) run_queue;
|
||||
};
|
||||
|
||||
// Blocks the current task on the given wait queue.
|
||||
// The caller must NOT hold any spinlocks. Returns after the task is woken.
|
||||
void sched_block(struct sched_percpu* sched, struct wait_queue* wq);
|
||||
|
||||
// Wakes the first task blocked on the given wait queue, if any.
|
||||
void sched_wake(struct sched_percpu* sched, struct wait_queue* wq);
|
||||
|
||||
// Wakes all tasks blocked on the given wait queue.
|
||||
void sched_wake_all(struct sched_percpu* sched, struct wait_queue* wq);
|
||||
|
||||
typedef void (*task_fn_t)(uintptr_t arg0);
|
||||
|
||||
errno_t task_create(const char* name, struct vma* space, task_fn_t entry, uintptr_t arg0, struct task** out);
|
||||
[[noreturn]]
|
||||
void task_entry(task_fn_t entry, uintptr_t arg0);
|
||||
|
||||
void sched_init(struct sched_percpu* sched);
|
||||
void sched_reschedule(struct sched_percpu* sched);
|
||||
void sched_yield(struct sched_percpu* sched);
|
||||
void sched_add_task(struct sched_percpu* sched, struct task* task);
|
||||
void sched_init(struct scheduler* sched);
|
||||
void sched_reschedule(struct scheduler* sched);
|
||||
void sched_yield(struct scheduler* sched);
|
||||
void sched_add_task(struct scheduler* sched, struct task* task);
|
||||
[[noreturn]]
|
||||
void sched_to_user(uintptr_t ctx);
|
||||
[[noreturn]]
|
||||
void sched_to_user_context(uintptr_t ctx);
|
||||
|
||||
// Info block for sched_to_user. Heap-allocated by the caller, freed by sched_to_user_arg.
|
||||
// Info block for sched_to_user.
|
||||
struct task_start_info {
|
||||
uintptr_t ip;
|
||||
uintptr_t sp;
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
|
||||
// Busy-waits in a loop until the lock is freed.
|
||||
// Does not put the CPU to sleep.
|
||||
typedef struct {
|
||||
struct spinlock {
|
||||
uint32_t owner;
|
||||
uint32_t next;
|
||||
} spinlock_t;
|
||||
};
|
||||
|
||||
// Attempts to lock a spinlock. If it's already locked, waits until it's freed.
|
||||
void spin_lock(spinlock_t* spin);
|
||||
void spin_lock(struct spinlock* spin);
|
||||
|
||||
// Unlocks a spinlock.
|
||||
void spin_unlock(spinlock_t* spin);
|
||||
void spin_unlock(struct spinlock* spin);
|
||||
|
||||
@@ -1,152 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <zinnia/sched.h>
|
||||
#include <zinnia/syscall.h>
|
||||
|
||||
#define SYSCALL_DECLARE(name) extern void sys_##name()
|
||||
|
||||
SYSCALL_DECLARE(exit);
|
||||
SYSCALL_DECLARE(syslog);
|
||||
SYSCALL_DECLARE(getuname);
|
||||
SYSCALL_DECLARE(setuname);
|
||||
SYSCALL_DECLARE(archctl);
|
||||
SYSCALL_DECLARE(reboot);
|
||||
SYSCALL_DECLARE(mmap);
|
||||
SYSCALL_DECLARE(munmap);
|
||||
SYSCALL_DECLARE(mprotect);
|
||||
SYSCALL_DECLARE(madvise);
|
||||
SYSCALL_DECLARE(sigprocmask);
|
||||
SYSCALL_DECLARE(sigsuspend);
|
||||
SYSCALL_DECLARE(sigpending);
|
||||
SYSCALL_DECLARE(sigaction);
|
||||
SYSCALL_DECLARE(sigtimedwait);
|
||||
SYSCALL_DECLARE(sigaltstack);
|
||||
SYSCALL_DECLARE(sigreturn);
|
||||
SYSCALL_DECLARE(sigqueue);
|
||||
SYSCALL_DECLARE(execve);
|
||||
SYSCALL_DECLARE(fexecve);
|
||||
SYSCALL_DECLARE(fork);
|
||||
SYSCALL_DECLARE(kill);
|
||||
SYSCALL_DECLARE(gettid);
|
||||
SYSCALL_DECLARE(getpid);
|
||||
SYSCALL_DECLARE(getppid);
|
||||
SYSCALL_DECLARE(waitid);
|
||||
SYSCALL_DECLARE(waitpid);
|
||||
SYSCALL_DECLARE(pread);
|
||||
SYSCALL_DECLARE(readv);
|
||||
SYSCALL_DECLARE(pwrite);
|
||||
SYSCALL_DECLARE(writev);
|
||||
SYSCALL_DECLARE(seek);
|
||||
SYSCALL_DECLARE(ioctl);
|
||||
SYSCALL_DECLARE(openat);
|
||||
SYSCALL_DECLARE(close);
|
||||
SYSCALL_DECLARE(fstat);
|
||||
SYSCALL_DECLARE(fstatat);
|
||||
SYSCALL_DECLARE(statvfs);
|
||||
SYSCALL_DECLARE(fstatvfs);
|
||||
SYSCALL_DECLARE(faccessat);
|
||||
SYSCALL_DECLARE(fcntl);
|
||||
SYSCALL_DECLARE(ftruncate);
|
||||
SYSCALL_DECLARE(truncate);
|
||||
SYSCALL_DECLARE(fallocate);
|
||||
SYSCALL_DECLARE(fadvise);
|
||||
SYSCALL_DECLARE(utimensat);
|
||||
SYSCALL_DECLARE(mknodat);
|
||||
SYSCALL_DECLARE(getcwd);
|
||||
SYSCALL_DECLARE(chdir);
|
||||
SYSCALL_DECLARE(fchdir);
|
||||
SYSCALL_DECLARE(mkdirat);
|
||||
SYSCALL_DECLARE(rmdirat);
|
||||
SYSCALL_DECLARE(getdents);
|
||||
SYSCALL_DECLARE(renameat);
|
||||
SYSCALL_DECLARE(fchmod);
|
||||
SYSCALL_DECLARE(fchmodat);
|
||||
SYSCALL_DECLARE(fchownat);
|
||||
SYSCALL_DECLARE(linkat);
|
||||
SYSCALL_DECLARE(symlinkat);
|
||||
SYSCALL_DECLARE(unlinkat);
|
||||
SYSCALL_DECLARE(readlinkat);
|
||||
SYSCALL_DECLARE(flock);
|
||||
SYSCALL_DECLARE(ppoll);
|
||||
SYSCALL_DECLARE(dup);
|
||||
SYSCALL_DECLARE(dup3);
|
||||
SYSCALL_DECLARE(sync);
|
||||
SYSCALL_DECLARE(fsync);
|
||||
SYSCALL_DECLARE(fdatasync);
|
||||
SYSCALL_DECLARE(getgroups);
|
||||
SYSCALL_DECLARE(setgroups);
|
||||
SYSCALL_DECLARE(getsid);
|
||||
SYSCALL_DECLARE(setsid);
|
||||
SYSCALL_DECLARE(setuid);
|
||||
SYSCALL_DECLARE(getuid);
|
||||
SYSCALL_DECLARE(setgid);
|
||||
SYSCALL_DECLARE(getgid);
|
||||
SYSCALL_DECLARE(geteuid);
|
||||
SYSCALL_DECLARE(seteuid);
|
||||
SYSCALL_DECLARE(getegid);
|
||||
SYSCALL_DECLARE(setegid);
|
||||
SYSCALL_DECLARE(getpgid);
|
||||
SYSCALL_DECLARE(setpgid);
|
||||
SYSCALL_DECLARE(getresuid);
|
||||
SYSCALL_DECLARE(setresuid);
|
||||
SYSCALL_DECLARE(getresgid);
|
||||
SYSCALL_DECLARE(setresgid);
|
||||
SYSCALL_DECLARE(setreuid);
|
||||
SYSCALL_DECLARE(setregid);
|
||||
SYSCALL_DECLARE(umask);
|
||||
SYSCALL_DECLARE(pipe);
|
||||
SYSCALL_DECLARE(futex_wait);
|
||||
SYSCALL_DECLARE(futex_wake);
|
||||
SYSCALL_DECLARE(thread_create);
|
||||
SYSCALL_DECLARE(thread_kill);
|
||||
SYSCALL_DECLARE(thread_exit);
|
||||
SYSCALL_DECLARE(thread_setname);
|
||||
SYSCALL_DECLARE(thread_getname);
|
||||
SYSCALL_DECLARE(timer_create);
|
||||
SYSCALL_DECLARE(timer_set);
|
||||
SYSCALL_DECLARE(timer_get);
|
||||
SYSCALL_DECLARE(timer_getoverrun);
|
||||
SYSCALL_DECLARE(timer_delete);
|
||||
SYSCALL_DECLARE(itimer_get);
|
||||
SYSCALL_DECLARE(itimer_set);
|
||||
SYSCALL_DECLARE(clock_get);
|
||||
SYSCALL_DECLARE(clock_getres);
|
||||
SYSCALL_DECLARE(clock_set);
|
||||
SYSCALL_DECLARE(sleep);
|
||||
SYSCALL_DECLARE(yield);
|
||||
SYSCALL_DECLARE(chroot);
|
||||
SYSCALL_DECLARE(mount);
|
||||
SYSCALL_DECLARE(umount);
|
||||
SYSCALL_DECLARE(socket);
|
||||
SYSCALL_DECLARE(socketpair);
|
||||
SYSCALL_DECLARE(shutdown);
|
||||
SYSCALL_DECLARE(bind);
|
||||
SYSCALL_DECLARE(connect);
|
||||
SYSCALL_DECLARE(accept);
|
||||
SYSCALL_DECLARE(listen);
|
||||
SYSCALL_DECLARE(getpeername);
|
||||
SYSCALL_DECLARE(getsockname);
|
||||
SYSCALL_DECLARE(getsockopt);
|
||||
SYSCALL_DECLARE(setsockopt);
|
||||
SYSCALL_DECLARE(sendmsg);
|
||||
SYSCALL_DECLARE(recvmsg);
|
||||
SYSCALL_DECLARE(getentropy);
|
||||
SYSCALL_DECLARE(getrusage);
|
||||
SYSCALL_DECLARE(getrlimit);
|
||||
SYSCALL_DECLARE(setrlimit);
|
||||
SYSCALL_DECLARE(getpriority);
|
||||
SYSCALL_DECLARE(setpriority);
|
||||
SYSCALL_DECLARE(sched_getparam);
|
||||
SYSCALL_DECLARE(sched_setparam);
|
||||
SYSCALL_DECLARE(module_insert);
|
||||
SYSCALL_DECLARE(module_remove);
|
||||
SYSCALL_DECLARE(epoll_create);
|
||||
SYSCALL_DECLARE(epoll_ctl);
|
||||
SYSCALL_DECLARE(epoll_pwait);
|
||||
SYSCALL_DECLARE(timerfd_create);
|
||||
SYSCALL_DECLARE(timerfd_gettime);
|
||||
SYSCALL_DECLARE(timerfd_settime);
|
||||
SYSCALL_DECLARE(signalfd_create);
|
||||
SYSCALL_DECLARE(eventfd_create);
|
||||
SYSCALL_DECLARE(msync);
|
||||
SYSCALL_DECLARE(sysconf);
|
||||
@@ -0,0 +1,149 @@
|
||||
#ifndef SYSCALL_DECLARE
|
||||
#define SYSCALL_DECLARE(number, name, num_args) extern void sys_##name();
|
||||
#endif
|
||||
|
||||
// SYSCALL_DECLARE(0, exit, -1)
|
||||
// SYSCALL_DECLARE(1, syslog, -1)
|
||||
SYSCALL_DECLARE(2, getuname, -1)
|
||||
// SYSCALL_DECLARE(3, setuname, -1)
|
||||
SYSCALL_DECLARE(4, archctl, -1)
|
||||
// SYSCALL_DECLARE(5, reboot, -1)
|
||||
// SYSCALL_DECLARE(6, mmap, -1)
|
||||
// SYSCALL_DECLARE(7, munmap, -1)
|
||||
// SYSCALL_DECLARE(8, mprotect, -1)
|
||||
// SYSCALL_DECLARE(9, madvise, -1)
|
||||
// SYSCALL_DECLARE(10, sigprocmask, -1)
|
||||
// SYSCALL_DECLARE(11, sigsuspend, -1)
|
||||
// SYSCALL_DECLARE(12, sigpending, -1)
|
||||
// SYSCALL_DECLARE(13, sigaction, -1)
|
||||
// SYSCALL_DECLARE(14, sigtimedwait, -1)
|
||||
// SYSCALL_DECLARE(15, sigaltstack, -1)
|
||||
// SYSCALL_DECLARE(16, sigreturn, -1)
|
||||
// SYSCALL_DECLARE(17, sigqueue, -1)
|
||||
// SYSCALL_DECLARE(18, execve, -1)
|
||||
// SYSCALL_DECLARE(19, fexecve, -1)
|
||||
// SYSCALL_DECLARE(20, fork, -1)
|
||||
// SYSCALL_DECLARE(21, kill, -1)
|
||||
// SYSCALL_DECLARE(22, gettid, -1)
|
||||
// SYSCALL_DECLARE(23, getpid, -1)
|
||||
// SYSCALL_DECLARE(24, getppid, -1)
|
||||
// SYSCALL_DECLARE(25, waitid, -1)
|
||||
// SYSCALL_DECLARE(26, waitpid, -1)
|
||||
// SYSCALL_DECLARE(27, pread, -1)
|
||||
// SYSCALL_DECLARE(28, readv, -1)
|
||||
// SYSCALL_DECLARE(29, pwrite, -1)
|
||||
// SYSCALL_DECLARE(30, writev, -1)
|
||||
// SYSCALL_DECLARE(31, seek, -1)
|
||||
// SYSCALL_DECLARE(32, ioctl, -1)
|
||||
// SYSCALL_DECLARE(33, openat, -1)
|
||||
// SYSCALL_DECLARE(34, close, -1)
|
||||
// SYSCALL_DECLARE(35, fstat, -1)
|
||||
// SYSCALL_DECLARE(36, fstatat, -1)
|
||||
// SYSCALL_DECLARE(37, statvfs, -1)
|
||||
// SYSCALL_DECLARE(38, fstatvfs, -1)
|
||||
// SYSCALL_DECLARE(39, faccessat, -1)
|
||||
// SYSCALL_DECLARE(40, fcntl, -1)
|
||||
// SYSCALL_DECLARE(41, ftruncate, -1)
|
||||
// SYSCALL_DECLARE(42, truncate, -1)
|
||||
// SYSCALL_DECLARE(43, fallocate, -1)
|
||||
// SYSCALL_DECLARE(44, fadvise, -1)
|
||||
// SYSCALL_DECLARE(45, utimensat, -1)
|
||||
// SYSCALL_DECLARE(46, mknodat, -1)
|
||||
// SYSCALL_DECLARE(47, getcwd, -1)
|
||||
// SYSCALL_DECLARE(48, chdir, -1)
|
||||
// SYSCALL_DECLARE(49, fchdir, -1)
|
||||
// SYSCALL_DECLARE(50, mkdirat, -1)
|
||||
// SYSCALL_DECLARE(51, rmdirat, -1)
|
||||
// SYSCALL_DECLARE(52, getdents, -1)
|
||||
// SYSCALL_DECLARE(53, renameat, -1)
|
||||
// SYSCALL_DECLARE(54, fchmod, -1)
|
||||
// SYSCALL_DECLARE(55, fchmodat, -1)
|
||||
// SYSCALL_DECLARE(56, fchownat, -1)
|
||||
// SYSCALL_DECLARE(57, linkat, -1)
|
||||
// SYSCALL_DECLARE(58, symlinkat, -1)
|
||||
// SYSCALL_DECLARE(59, unlinkat, -1)
|
||||
// SYSCALL_DECLARE(60, readlinkat, -1)
|
||||
// SYSCALL_DECLARE(61, flock, -1)
|
||||
// SYSCALL_DECLARE(62, ppoll, -1)
|
||||
// SYSCALL_DECLARE(63, dup, -1)
|
||||
// SYSCALL_DECLARE(64, dup3, -1)
|
||||
// SYSCALL_DECLARE(65, sync, -1)
|
||||
// SYSCALL_DECLARE(66, fsync, -1)
|
||||
// SYSCALL_DECLARE(67, fdatasync, -1)
|
||||
// SYSCALL_DECLARE(68, getgroups, -1)
|
||||
// SYSCALL_DECLARE(69, setgroups, -1)
|
||||
// SYSCALL_DECLARE(70, getsid, -1)
|
||||
// SYSCALL_DECLARE(71, setsid, -1)
|
||||
// SYSCALL_DECLARE(72, setuid, -1)
|
||||
// SYSCALL_DECLARE(73, getuid, -1)
|
||||
// SYSCALL_DECLARE(74, setgid, -1)
|
||||
// SYSCALL_DECLARE(75, getgid, -1)
|
||||
// SYSCALL_DECLARE(76, geteuid, -1)
|
||||
// SYSCALL_DECLARE(77, seteuid, -1)
|
||||
// SYSCALL_DECLARE(78, getegid, -1)
|
||||
// SYSCALL_DECLARE(79, setegid, -1)
|
||||
// SYSCALL_DECLARE(80, getpgid, -1)
|
||||
// SYSCALL_DECLARE(81, setpgid, -1)
|
||||
// SYSCALL_DECLARE(82, getresuid, -1)
|
||||
// SYSCALL_DECLARE(83, setresuid, -1)
|
||||
// SYSCALL_DECLARE(84, getresgid, -1)
|
||||
// SYSCALL_DECLARE(85, setresgid, -1)
|
||||
// SYSCALL_DECLARE(86, setreuid, -1)
|
||||
// SYSCALL_DECLARE(87, setregid, -1)
|
||||
// SYSCALL_DECLARE(88, umask, -1)
|
||||
// SYSCALL_DECLARE(89, pipe, -1)
|
||||
// SYSCALL_DECLARE(90, futex_wait, -1)
|
||||
// SYSCALL_DECLARE(91, futex_wake, -1)
|
||||
// SYSCALL_DECLARE(92, thread_create, -1)
|
||||
// SYSCALL_DECLARE(93, thread_kill, -1)
|
||||
// SYSCALL_DECLARE(94, thread_exit, -1)
|
||||
// SYSCALL_DECLARE(95, thread_setname, -1)
|
||||
// SYSCALL_DECLARE(96, thread_getname, -1)
|
||||
// SYSCALL_DECLARE(97, timer_create, -1)
|
||||
// SYSCALL_DECLARE(98, timer_set, -1)
|
||||
// SYSCALL_DECLARE(99, timer_get, -1)
|
||||
// SYSCALL_DECLARE(100, timer_getoverrun, -1)
|
||||
// SYSCALL_DECLARE(101, timer_delete, -1)
|
||||
// SYSCALL_DECLARE(102, itimer_get, -1)
|
||||
// SYSCALL_DECLARE(103, itimer_set, -1)
|
||||
// SYSCALL_DECLARE(104, clock_get, -1)
|
||||
// SYSCALL_DECLARE(105, clock_getres, -1)
|
||||
// SYSCALL_DECLARE(106, clock_set, -1)
|
||||
// SYSCALL_DECLARE(107, sleep, -1)
|
||||
// SYSCALL_DECLARE(108, yield, -1)
|
||||
// SYSCALL_DECLARE(109, chroot, -1)
|
||||
// SYSCALL_DECLARE(110, mount, -1)
|
||||
// SYSCALL_DECLARE(111, umount, -1)
|
||||
// SYSCALL_DECLARE(112, socket, -1)
|
||||
// SYSCALL_DECLARE(113, socketpair, -1)
|
||||
// SYSCALL_DECLARE(114, shutdown, -1)
|
||||
// SYSCALL_DECLARE(115, bind, -1)
|
||||
// SYSCALL_DECLARE(116, connect, -1)
|
||||
// SYSCALL_DECLARE(117, accept, -1)
|
||||
// SYSCALL_DECLARE(118, listen, -1)
|
||||
// SYSCALL_DECLARE(119, getpeername, -1)
|
||||
// SYSCALL_DECLARE(120, getsockname, -1)
|
||||
// SYSCALL_DECLARE(121, getsockopt, -1)
|
||||
// SYSCALL_DECLARE(122, setsockopt, -1)
|
||||
// SYSCALL_DECLARE(123, sendmsg, -1)
|
||||
// SYSCALL_DECLARE(124, recvmsg, -1)
|
||||
// SYSCALL_DECLARE(125, getentropy, -1)
|
||||
// SYSCALL_DECLARE(126, getrusage, -1)
|
||||
// SYSCALL_DECLARE(127, getrlimit, -1)
|
||||
// SYSCALL_DECLARE(128, setrlimit, -1)
|
||||
// SYSCALL_DECLARE(129, getpriority, -1)
|
||||
// SYSCALL_DECLARE(130, setpriority, -1)
|
||||
// SYSCALL_DECLARE(131, sched_getparam, -1)
|
||||
// SYSCALL_DECLARE(132, sched_setparam, -1)
|
||||
// SYSCALL_DECLARE(133, module_insert, -1)
|
||||
// SYSCALL_DECLARE(134, module_remove, -1)
|
||||
// SYSCALL_DECLARE(135, epoll_create, -1)
|
||||
// SYSCALL_DECLARE(136, epoll_ctl, -1)
|
||||
// SYSCALL_DECLARE(137, epoll_pwait, -1)
|
||||
// SYSCALL_DECLARE(138, timerfd_create, -1)
|
||||
// SYSCALL_DECLARE(139, timerfd_gettime, -1)
|
||||
// SYSCALL_DECLARE(140, timerfd_settime, -1)
|
||||
// SYSCALL_DECLARE(141, signalfd_create, -1)
|
||||
// SYSCALL_DECLARE(142, eventfd_create, -1)
|
||||
// SYSCALL_DECLARE(143, msync, -1)
|
||||
// SYSCALL_DECLARE(144, sysconf, -1)
|
||||
@@ -2,6 +2,24 @@
|
||||
|
||||
#include <zinnia/utils.h>
|
||||
#include <bits/types.h>
|
||||
#include <uapi/types.h>
|
||||
|
||||
ASSERT_TYPE(phys_t);
|
||||
ASSERT_TYPE(virt_t);
|
||||
|
||||
typedef __off_t off_t;
|
||||
typedef __off64_t off64_t;
|
||||
typedef __blksize_t blksize_t;
|
||||
typedef __blkcnt_t blkcnt_t;
|
||||
typedef __clockid_t clockid_t;
|
||||
typedef __dev_t dev_t;
|
||||
typedef __gid_t gid_t;
|
||||
typedef __ino_t ino_t;
|
||||
typedef __mode_t mode_t;
|
||||
typedef __nlink_t nlink_t;
|
||||
typedef __pid_t pid_t;
|
||||
typedef __rlim_t rlim_t;
|
||||
typedef __uid_t uid_t;
|
||||
typedef __fsblkcnt_t fsblkcnt_t;
|
||||
typedef __fsfilcnt_t fsfilcnt_t;
|
||||
typedef __pthread_attr_t pthread_attr_t;
|
||||
|
||||
+63
-10
@@ -1,11 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <zinnia/errno.h>
|
||||
#include <zinnia/ident.h>
|
||||
#include <zinnia/iovec.h>
|
||||
#include <zinnia/refcount.h>
|
||||
#include <zinnia/spin.h>
|
||||
#include <zinnia/types.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <uapi/fcntl.h>
|
||||
#include <uapi/stat.h>
|
||||
|
||||
enum open_flags : uint32_t {
|
||||
O_RDONLY = __O_RDONLY,
|
||||
@@ -49,18 +53,67 @@ struct vfs_path {
|
||||
struct vfs_entry* entry;
|
||||
};
|
||||
|
||||
errno_t vfs_path_mount();
|
||||
errno_t vfs_path_lookup(struct vfs_path);
|
||||
|
||||
enum vfs_node_type {
|
||||
VNODE_REGULAR,
|
||||
VNODE_DIRECTORY,
|
||||
VNODE_SYMLINK,
|
||||
VNODE_FIFO,
|
||||
VNODE_BLOCKDEV,
|
||||
VNODE_CHARDEV,
|
||||
VNODE_SOCKET,
|
||||
};
|
||||
|
||||
struct vfs_file;
|
||||
struct vfs_node;
|
||||
struct vfs_regular_ops {
|
||||
errno_t (*read)(struct vfs_node* file, struct iovec_iter* buffer, uint64_t offset, ssize_t* out_read);
|
||||
errno_t (*write)(struct vfs_node* file, struct iovec_iter* buffer, uint64_t offset, ssize_t* out_written);
|
||||
errno_t (*devctl)(struct vfs_node* file);
|
||||
struct vfs_node_ops {
|
||||
errno_t (*sync)();
|
||||
union {
|
||||
struct {
|
||||
errno_t (*truncate)(struct vfs_node*, uint64_t new_length);
|
||||
} regular;
|
||||
struct {
|
||||
errno_t (*read_link)(struct vfs_node*, char* buf, size_t len, size_t* out_written);
|
||||
} symlink;
|
||||
struct {
|
||||
errno_t (*lookup)(struct vfs_node*, struct vfs_path entry);
|
||||
errno_t (*open)(
|
||||
struct vfs_node*,
|
||||
struct vfs_path entry,
|
||||
enum open_flags flags,
|
||||
const struct ident* identity,
|
||||
struct vfs_file* out_file
|
||||
);
|
||||
errno_t (*create)(struct vfs_node*, const struct ident* identity);
|
||||
} dir;
|
||||
};
|
||||
};
|
||||
|
||||
struct vfs_node {
|
||||
struct refcount rc;
|
||||
const struct vfs_regular_ops* ops;
|
||||
struct vfs_vnode* vnode;
|
||||
struct vfs_path path;
|
||||
const char* abs_path;
|
||||
bool has_path;
|
||||
enum vfs_node_type type;
|
||||
bool is_seekable;
|
||||
};
|
||||
|
||||
struct vfs_file;
|
||||
struct vfs_file_ops {
|
||||
errno_t (*read)(struct vfs_file* file, struct iovec_iter* buffer, uint64_t offset, ssize_t* out_read);
|
||||
errno_t (*write)(struct vfs_file* file, struct iovec_iter* buffer, uint64_t offset, ssize_t* out_written);
|
||||
errno_t (*ioctl)(struct vfs_file* file, uintptr_t request, uintptr_t arg, uintptr_t* out_result);
|
||||
};
|
||||
|
||||
struct vfs_file {
|
||||
struct refcount rc;
|
||||
const struct vfs_file_ops* ops; // vtable for operations on this open file.
|
||||
struct vfs_node* vnode; // The opened vnode.
|
||||
const char* abs_path; // Absolute path resolved during `open()`.
|
||||
struct spinlock lock;
|
||||
|
||||
struct vfs_path path; // The cached entry pointing to this node.
|
||||
bool has_path; // If this file has a path.
|
||||
};
|
||||
|
||||
errno_t vfs_file_read(struct vfs_file* file, struct iovec_iter* buffer, uint64_t offset, ssize_t* out_read);
|
||||
errno_t vfs_file_write(struct vfs_file* file, struct iovec_iter* buffer, uint64_t offset, ssize_t* out_written);
|
||||
errno_t vfs_file_ioctl(struct vfs_file* file, uintptr_t request, uintptr_t arg, uintptr_t* out_result);
|
||||
|
||||
@@ -27,6 +27,7 @@ struct pager_ops {
|
||||
errno_t (*put_page)(struct pager_ops* pager, uintptr_t offset_idx, struct page* page);
|
||||
};
|
||||
|
||||
// TODO: change to btree
|
||||
struct page_list {
|
||||
uintptr_t offset;
|
||||
struct page* value;
|
||||
@@ -37,7 +38,7 @@ struct paged_vmo {
|
||||
struct vmo object;
|
||||
struct pager_ops source;
|
||||
list_head(struct page_list*) cache;
|
||||
spinlock_t lock;
|
||||
struct spinlock lock;
|
||||
};
|
||||
|
||||
errno_t vmo_new_paged(struct pager_ops ops, struct paged_vmo** out);
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <zinnia/spin.h>
|
||||
#include <zinnia/tailq.h>
|
||||
|
||||
struct task;
|
||||
|
||||
// A queue of tasks waiting for an event.
|
||||
struct wait_queue {
|
||||
tailq_head(struct task) waiters;
|
||||
spinlock_t lock;
|
||||
};
|
||||
|
||||
void wait_queue_init(struct wait_queue* wq);
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <zinnia/atomic.h>
|
||||
#include <zinnia/sched.h>
|
||||
#include <zinnia/spin.h>
|
||||
#include <zinnia/tailq.h>
|
||||
|
||||
// A queue of tasks waiting for an event.
|
||||
struct waitq {
|
||||
tailq_head(atomic(struct task)) waiters;
|
||||
atomic(bool) woken;
|
||||
};
|
||||
|
||||
void waitq_init(struct waitq* wq);
|
||||
void waitq_wait(struct waitq* wq);
|
||||
void waitq_wake_one(struct waitq* wq);
|
||||
void waitq_wake_all(struct waitq* wq);
|
||||
Reference in New Issue
Block a user