libos: Add Process::exit()
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c72c6312d4
commit
5458286309
@ -81,5 +81,12 @@ namespace os
|
||||
* @return Result<void> Whether the function succeeded.
|
||||
*/
|
||||
static Result<void> kill(pid_t pid, int signo);
|
||||
|
||||
/**
|
||||
* @brief Exit the current process.
|
||||
*
|
||||
* @param status The exit status code to return to the parent.
|
||||
*/
|
||||
[[noreturn]] static void exit(int status);
|
||||
};
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <os/Process.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@ -74,4 +75,9 @@ namespace os
|
||||
long rc = syscall(SYS_kill, pid, signo);
|
||||
return Result<void>::from_syscall(rc);
|
||||
}
|
||||
|
||||
[[noreturn]] void Process::exit(int status)
|
||||
{
|
||||
::exit(status);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user