Revise PID and TID generation to align with standards

This commit is contained in:
EnderIce2
2024-03-02 00:51:06 +02:00
parent 525a102f20
commit d3a16469ad
9 changed files with 27 additions and 20 deletions

View File

@ -501,6 +501,13 @@ namespace Driver
return tcb->ID;
}
pid_t GetCurrentProcess(dev_t MajorID)
{
dbg_api("%d", MajorID);
return TaskManager->GetCurrentProcess()->ID;
}
int KillProcess(dev_t MajorID, pid_t pId, int ExitCode)
{
dbg_api("%d, %d, %d", MajorID, pId, ExitCode);
@ -512,11 +519,11 @@ namespace Driver
return 0;
}
int KillThread(dev_t MajorID, pid_t tId, int ExitCode)
int KillThread(dev_t MajorID, pid_t tId, pid_t pId, int ExitCode)
{
dbg_api("%d, %d, %d", MajorID, tId, ExitCode);
Tasking::TCB *tcb = TaskManager->GetThreadByID(tId);
Tasking::TCB *tcb = TaskManager->GetThreadByID(tId, TaskManager->GetProcessByID(pId));
if (!tcb)
return -EINVAL;
TaskManager->KillThread(tcb, (Tasking::KillCode)ExitCode);
@ -913,6 +920,7 @@ namespace Driver
api->CreateKernelProcess = CreateKernelProcess;
api->CreateKernelThread = CreateKernelThread;
api->GetCurrentProcess = GetCurrentProcess;
api->KillProcess = KillProcess;
api->KillThread = KillThread;
api->Yield = Yield;