Generate new PIDs for processes

This commit is contained in:
2026-01-05 20:24:26 +01:00
parent fcd5658a80
commit 6538fd8023

View File

@@ -9,6 +9,8 @@
#include <sync/spin_lock.h>
#include <sys/debug.h>
static atomic_int pids = 1;
struct proc* proc_from_elf (uint8_t* elf_contents) {
struct limine_hhdm_response* hhdm = limine_hhdm_request.response;
@@ -54,6 +56,7 @@ struct proc* proc_from_elf (uint8_t* elf_contents) {
proc->pdata.regs.rip = aux.entry;
proc->lock = SPIN_LOCK_INIT;
atomic_store (&proc->state, PROC_READY);
proc->pid = atomic_fetch_add (&pids, 1);
return proc;
}