diff --git a/CMakeLists.txt b/CMakeLists.txt index 7852235..06c9b7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -190,6 +190,8 @@ set(SOURCES src/stdlib/strtoll.c src/stdlib/strtoul.c src/stdlib/strtoull.c + # unistd + src/unistd/_exit.c # string src/string/memchr.c src/string/memcmp.c diff --git a/include/unistd.h b/include/unistd.h index faf2394..886fa4f 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -45,6 +45,10 @@ extern char *getcwd(char *__buf, size_t __size); extern int chdir(char const *__path); +/* Exit immediately, bypassing exit handlers or signal handlers. */ +__attribute__((noreturn)) +extern void _exit(int __status); + /* Kernel-style functions supported only by Vhex. */ diff --git a/src/unistd/_exit.c b/src/unistd/_exit.c new file mode 100644 index 0000000..c7199fa --- /dev/null +++ b/src/unistd/_exit.c @@ -0,0 +1,4 @@ +#include + +/* Exit immediately, bypassing exit handlers or signal handlers. */ +void _exit(int status) __attribute__((alias("_Exit")));