summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/lib/abort.c
blob: 7c49a32efb75fb41524ed8305eea2d8c04aee60c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <sys/types.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>

#ifndef __PIC__
void __stdio_flushall(void) __attribute__((weak));
void __stdio_flushall(void) { }
#endif

void abort() {
  sigset_t t;
  __stdio_flushall();
  if (!sigemptyset(&t) && !sigaddset(&t, SIGABRT))
    sigprocmask(SIG_UNBLOCK, &t, 0);
  while (1)
    if (raise(SIGABRT))
      exit(127);
}