libos: Add Process::exit()
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
apio 2023-07-21 21:21:08 +02:00
parent c72c6312d4
commit 5458286309
Signed by: apio
GPG Key ID: B8A7D06E42258954
2 changed files with 13 additions and 0 deletions

View File

@ -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);
};
}

View File

@ -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);
}
}