1 /*
2 * Copyright (c) 1985, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * %sccs.include.redist.c%
6 */
7
8 #if defined(LIBC_SCCS) && !defined(lint)
9 static char sccsid[] = "@(#)abort.c 8.1 (Berkeley) 06/04/93";
10 #endif /* LIBC_SCCS and not lint */
11
12 #include <sys/signal.h>
13 #include <stdlib.h>
14 #include <stddef.h>
15 #include <unistd.h>
16
17 void
abort()18 abort()
19 {
20 sigset_t mask;
21
22 sigfillset(&mask);
23 /*
24 * don't block SIGABRT to give any handler a chance; we ignore
25 * any errors -- X311J doesn't allow abort to return anyway.
26 */
27 sigdelset(&mask, SIGABRT);
28 (void)sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL);
29 (void)kill(getpid(), SIGABRT);
30
31 /*
32 * if SIGABRT ignored, or caught and the handler returns, do
33 * it again, only harder.
34 */
35 (void)signal(SIGABRT, SIG_DFL);
36 (void)sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL);
37 (void)kill(getpid(), SIGABRT);
38 exit(1);
39 }
40