Introduce concept of Process Resources (PR_MEM), implement necessary syscalls
All checks were successful
Build documentation / build-and-deploy (push) Successful in 42s

This commit is contained in:
2026-01-07 22:47:30 +01:00
parent 28aef30f77
commit d7b734306f
16 changed files with 451 additions and 50 deletions

44
kernel/proc/resource.h Normal file
View File

@@ -0,0 +1,44 @@
#ifndef _KERNEL_PROC_RESOURCE_H
#define _KERNEL_PROC_RESOURCE_H
#include <libk/rbtree.h>
#include <libk/std.h>
#include <sync/spin_lock.h>
#define PR_MEM 0
#define RV_PRIVATE 0
#define RV_PUBLIC 1
struct proc;
struct proc_resource_mem {
uintptr_t paddr;
size_t pages;
};
struct proc_resource_mem_init {
size_t pages;
};
struct proc_resource {
int type;
int rid;
int visibility;
spin_lock_t lock;
atomic_int refs;
struct rb_node_link proc_resource_tree_link;
union {
struct proc_resource_mem mem;
} u;
struct {
void (*cleanup) (struct proc_resource* resource);
} ops;
};
struct proc_resource* proc_create_resource (struct proc* proc, int rid, int type, int vis,
void* data);
void proc_drop_resource (struct proc* proc, struct proc_resource* resource);
void proc_cleanup_resources (struct proc* proc);
#endif // _KERNEL_PROC_RESOURCE_H