Generate new PIDs for processes
This commit is contained in:
@@ -9,6 +9,8 @@
|
|||||||
#include <sync/spin_lock.h>
|
#include <sync/spin_lock.h>
|
||||||
#include <sys/debug.h>
|
#include <sys/debug.h>
|
||||||
|
|
||||||
|
static atomic_int pids = 1;
|
||||||
|
|
||||||
struct proc* proc_from_elf (uint8_t* elf_contents) {
|
struct proc* proc_from_elf (uint8_t* elf_contents) {
|
||||||
struct limine_hhdm_response* hhdm = limine_hhdm_request.response;
|
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->pdata.regs.rip = aux.entry;
|
||||||
proc->lock = SPIN_LOCK_INIT;
|
proc->lock = SPIN_LOCK_INIT;
|
||||||
atomic_store (&proc->state, PROC_READY);
|
atomic_store (&proc->state, PROC_READY);
|
||||||
|
proc->pid = atomic_fetch_add (&pids, 1);
|
||||||
|
|
||||||
return proc;
|
return proc;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user