process: Switch to array + bitmap for fd allocations
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user