]> git.saurik.com Git - apple/libc.git/blob - stdlib/FreeBSD/abort.c.patch
f209119e3a15c70b5a37331660d99a4ec726a511
[apple/libc.git] / stdlib / FreeBSD / abort.c.patch
1 --- abort.c.orig 2007-04-17 01:31:46.000000000 -0700
2 +++ abort.c 2007-04-17 01:36:22.000000000 -0700
3 @@ -45,7 +45,10 @@
4 #include <pthread.h>
5 #include "un-namespace.h"
6
7 -void (*__cleanup)();
8 +extern void (*__cleanup)();
9 +extern void __abort(void) __dead2;
10 +
11 +#define TIMEOUT 10000 /* 10 milliseconds */
12
13 void
14 abort()
15 @@ -67,11 +70,20 @@
16 sigdelset(&act.sa_mask, SIGABRT);
17 (void)_sigprocmask(SIG_SETMASK, &act.sa_mask, NULL);
18 (void)raise(SIGABRT);
19 + usleep(TIMEOUT); /* give time for signal to happen */
20
21 /*
22 * If SIGABRT was ignored, or caught and the handler returns, do
23 * it again, only harder.
24 */
25 + __abort();
26 +}
27 +
28 +__private_extern__ void
29 +__abort()
30 +{
31 + struct sigaction act;
32 +
33 act.sa_handler = SIG_DFL;
34 act.sa_flags = 0;
35 sigfillset(&act.sa_mask);
36 @@ -79,5 +91,6 @@
37 sigdelset(&act.sa_mask, SIGABRT);
38 (void)_sigprocmask(SIG_SETMASK, &act.sa_mask, NULL);
39 (void)raise(SIGABRT);
40 - exit(1);
41 + usleep(TIMEOUT); /* give time for signal to happen */
42 + __builtin_trap(); /* never exit normally */
43 }