2022-10-19 15:41:23 +00:00
|
|
|
#include "std/errno.h"
|
2022-10-18 15:36:17 +00:00
|
|
|
#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;
|
|
|
|
}
|
|
|
|
}
|