Manage int IDs via id_alloc
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m31s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m31s
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include <aux/elf.h>
|
||||
#include <desc.h>
|
||||
#include <fs/vfs.h>
|
||||
#include <id/id_alloc.h>
|
||||
#include <irq/irq.h>
|
||||
#include <libk/align.h>
|
||||
#include <libk/list.h>
|
||||
@@ -29,6 +30,8 @@
|
||||
#include <amd64/intr_defs.h>
|
||||
#endif
|
||||
|
||||
#define PIDS_MAX 1024
|
||||
|
||||
#define SCHED_REAP_FREQ 10
|
||||
|
||||
static struct rb_node_link* proc_tree = NULL;
|
||||
@@ -36,6 +39,14 @@ static spin_lock_t proc_tree_lock = SPIN_LOCK_INIT;
|
||||
|
||||
static atomic_int sched_cycles = 0;
|
||||
|
||||
static struct id_alloc pid_alloc;
|
||||
|
||||
int proc_alloc_pid (void) { return id_alloc (&pid_alloc); }
|
||||
|
||||
void proc_free_pid (int pid) { id_free (&pid_alloc, pid); }
|
||||
|
||||
void proc_pid_alloc_init (void) { id_alloc_init (&pid_alloc, PIDS_MAX); }
|
||||
|
||||
static bool proc_check_elf (uint8_t* elf) {
|
||||
if (!((elf[0] == 0x7F) && (elf[1] == 'E') && (elf[2] == 'L') && (elf[3] == 'F')))
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user