libc: Implement _Exit

Exactly the same as _exit, but in stdlib.h instead of unistd.h
This commit is contained in:
apio 2022-10-15 14:02:10 +02:00
parent b1739f7f0d
commit 2395c7a871
2 changed files with 10 additions and 1 deletions

View File

@ -15,6 +15,9 @@ extern "C"
/* Normally exits the program with the specified status code. */ /* Normally exits the program with the specified status code. */
__lc_noreturn void exit(int status); __lc_noreturn void exit(int status);
/* Abnormally exits the program with the specified status code. */
__lc_noreturn void _Exit(int status);
/* Registers a handler function to be run at normal program termination. */ /* Registers a handler function to be run at normal program termination. */
int atexit(void (*handler)(void)); int atexit(void (*handler)(void));

View File

@ -7,7 +7,7 @@ extern "C"
{ {
__lc_noreturn void abort() __lc_noreturn void abort()
{ {
_exit(-1); _Exit(-1);
} }
int atoi(const char*) int atoi(const char*)
@ -19,4 +19,10 @@ extern "C"
{ {
NOT_IMPLEMENTED("getenv"); NOT_IMPLEMENTED("getenv");
} }
__lc_noreturn void _Exit(int status)
{
syscall(SYS_exit, status);
__lc_unreachable();
}
} }