LibC: Implement spec compliant abort()

This commit is contained in:
Bananymous 2025-04-01 23:06:30 +03:00
parent 36026d4ec6
commit 788f5429e1
1 changed files with 9 additions and 3 deletions
userspace/libraries/LibC

View File

@ -27,9 +27,15 @@ static uint32_t at_exit_funcs_count = 0;
void abort(void)
{
fflush(nullptr);
fprintf(stderr, "abort()\n");
exit(1);
sigset_t set;
sigemptyset(&set);
sigaddset(&set, SIGABRT);
sigprocmask(SIG_UNBLOCK, &set, nullptr);
raise(SIGABRT);
signal(SIGABRT, SIG_DFL);
raise(SIGABRT);
ASSERT_NOT_REACHED();
}