Luna/kernel/src/sys/id.cpp
apio 52d391507d Kernel: Rename the getpid() syscall to getprocid()
Now, we have one single system call to fetch all sorts of identifiers:
PID, PPID, UID, GID; EUID, EGID, and more...
2022-10-18 17:36:17 +02:00

24 lines
428 B
C++

#include "errno.h"
#include "thread/Scheduler.h"
#define ID_PID 0
#define ID_PPID 1
void sys_getprocid(Context* context, int field)
{
if (field == ID_PID)
{
context->rax = Scheduler::current_task()->id;
return;
}
else if (field == ID_PPID)
{
context->rax = Scheduler::current_task()->ppid;
return;
}
else
{
context->rax = -EINVAL;
return;
}
}