diff --git a/libs/libc/include/stdlib.h b/libs/libc/include/stdlib.h index 16e4053c..99de9f34 100644 --- a/libs/libc/include/stdlib.h +++ b/libs/libc/include/stdlib.h @@ -15,6 +15,9 @@ extern "C" /* Normally exits the program with the specified status code. */ __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. */ int atexit(void (*handler)(void)); diff --git a/libs/libc/src/stdlib.cpp b/libs/libc/src/stdlib.cpp index eb5261f7..cd872434 100644 --- a/libs/libc/src/stdlib.cpp +++ b/libs/libc/src/stdlib.cpp @@ -7,7 +7,7 @@ extern "C" { __lc_noreturn void abort() { - _exit(-1); + _Exit(-1); } int atoi(const char*) @@ -19,4 +19,10 @@ extern "C" { NOT_IMPLEMENTED("getenv"); } + + __lc_noreturn void _Exit(int status) + { + syscall(SYS_exit, status); + __lc_unreachable(); + } } \ No newline at end of file