summaryrefslogtreecommitdiff
path: root/src/kernel/proc.h
diff options
context:
space:
mode:
authordzwdz2024-05-11 20:24:17 +0200
committerdzwdz2024-05-11 20:24:17 +0200
commit9047f1e3f502658de12808015179ab3881a4b03f (patch)
tree4b7f19f3152ab1ed19bc83e2213c679f41110e86 /src/kernel/proc.h
parent1e9887d904280c43c5a92570a07627689c89b48f (diff)
kernel: refactor handle management out of proc.c
Diffstat (limited to 'src/kernel/proc.h')
-rw-r--r--src/kernel/proc.h22
1 files changed, 2 insertions, 20 deletions
diff --git a/src/kernel/proc.h b/src/kernel/proc.h
index 24206fb..f4b6b97 100644
--- a/src/kernel/proc.h
+++ b/src/kernel/proc.h
@@ -1,11 +1,9 @@
#pragma once
#include <kernel/arch/generic.h>
-#include <kernel/handle.h>
+#include <kernel/handleset.h>
#include <kernel/types.h>
#include <stdbool.h>
-#define HANDLE_MAX 16
-
/* legal transitions described by proc_setstate */
enum proc_state {
PS_RUNNING,
@@ -66,8 +64,7 @@ struct Proc {
};
VfsMount *mount;
- Handle **_handles; /* points to Handle *[HANDLE_MAX] */
- uint64_t *handles_refcount; /* works just like pages_refcount */
+ HandleSet *hs;
// TODO pids should be 64bit. also typedef pid_t
uint32_t globalid; /* only for internal use, don't expose to userland */
@@ -130,21 +127,6 @@ _Noreturn void proc_switch_any(void);
Proc *proc_next(Proc *root, Proc *p);
-hid_t proc_find_free_handle(Proc *proc, hid_t start_at);
-Handle *proc_handle_get(Proc *, hid_t);
-hid_t proc_handle_init(Proc *, enum handle_type, Handle **);
-hid_t proc_handle_dup(Proc *p, hid_t from, hid_t to, int flags);
-static inline void proc_handle_close(Proc *p, hid_t hid) {
- proc_handle_dup(p, -1, hid, 0);
-}
-
-/* Gets a handle and removes the process' reference to it, without decreasing the refcount.
- * Meant to be used together with proc_handle_put. */
-Handle *proc_hid_take(Proc *, hid_t);
-/* Put a handle in a process, taking the ownership away from the caller.
- * Doesn't increase the refcount on success, decreases it on failure. */
-hid_t proc_handle_put(Proc *, Handle *);
-
void proc_setstate(Proc *, enum proc_state);
size_t pcpy_to(Proc *p, __user void *dst, const void *src, size_t len);