Luna/kernel/src/sys/id.cpp

24 lines
432 B
C++
Raw Normal View History

#include "std/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;
}
}