process: Switch to array + bitmap for fd allocations

This commit is contained in:
2026-10-26 21:37:11 +01:00
parent 2b35f2edf4
commit 52ed52c332
2 changed files with 122 additions and 57 deletions
+7 -5
View File
@@ -4,7 +4,6 @@
#include <zinnia/atomic.h>
#include <zinnia/errno.h>
#include <zinnia/hashmap.h>
#include <zinnia/ident.h>
#include <zinnia/mutex.h>
#include <zinnia/refcount.h>
@@ -26,9 +25,12 @@ struct process_rlimit {
rlim_t max;
};
struct fd_entry {
struct vfs_file* file;
bool cloexec;
struct fd_table {
struct vfs_file** files;
uint64_t* open;
uint64_t* cloexec;
size_t capacity;
size_t next_free;
};
struct process {
@@ -50,7 +52,7 @@ struct process {
struct process_rlimit limit_nofile;
mutex_t files_lock;
hashmap(int, struct fd_entry) files;
struct fd_table files;
};
struct process* process_kernel();