[Zion] Add a ProcessWait syscall.
This commit is contained in:
parent
642fc4d80d
commit
d9a4be6555
8 changed files with 29 additions and 8 deletions
|
|
@ -9,7 +9,7 @@
|
|||
z_err_t ProcessExit(ZProcessExitReq* req) {
|
||||
auto curr_thread = gScheduler->CurrentThread();
|
||||
dbgln("Exit code: {}", static_cast<glcr::ErrorCode>(req->code));
|
||||
curr_thread->process().Exit();
|
||||
curr_thread->process().Exit(req->code);
|
||||
panic("Returned from thread exit");
|
||||
return glcr::UNIMPLEMENTED;
|
||||
}
|
||||
|
|
@ -39,3 +39,17 @@ z_err_t ProcessSpawn(ZProcessSpawnReq* req) {
|
|||
|
||||
return glcr::OK;
|
||||
}
|
||||
|
||||
z_err_t ProcessWait(ZProcessWaitReq* req) {
|
||||
auto& curr_proc = gScheduler->CurrentProcess();
|
||||
auto cap = curr_proc.GetCapability(req->proc_cap);
|
||||
RET_ERR(ValidateCapability<Process>(cap, kZionPerm_Read));
|
||||
|
||||
auto proc = cap->obj<Process>();
|
||||
if (proc->id() == curr_proc.id()) {
|
||||
return glcr::INVALID_ARGUMENT;
|
||||
}
|
||||
proc->GetThread(0)->Wait();
|
||||
*req->exit_code = proc->exit_code();
|
||||
return glcr::OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,3 +4,4 @@
|
|||
|
||||
z_err_t ProcessExit(ZProcessExitReq* req);
|
||||
z_err_t ProcessSpawn(ZProcessSpawnReq* req);
|
||||
z_err_t ProcessWait(ZProcessWaitReq* req);
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ extern "C" z_err_t SyscallHandler(uint64_t call_id, void* req) {
|
|||
// syscall/process.h
|
||||
CASE(ProcessExit);
|
||||
CASE(ProcessSpawn);
|
||||
CASE(ProcessWait);
|
||||
// syscall/thread.h
|
||||
CASE(ThreadCreate);
|
||||
CASE(ThreadStart);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue