Now, we have one single system call to fetch all sorts of identifiers: PID, PPID, UID, GID; EUID, EGID, and more...
24 lines
428 B
C++
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;
|
|
}
|
|
} |