flag fields are u_int's
[unix-history] / usr / src / lib / libc / stdlib / abort.c
CommitLineData
bb0cfa24 1/*
007be9f5 2 * Copyright (c) 1985 Regents of the University of California.
84cb68a1
KB
3 * All rights reserved.
4 *
019bea33 5 * %sccs.include.redist.c%
bb0cfa24
DF
6 */
7
2ce81398 8#if defined(LIBC_SCCS) && !defined(lint)
f0a345ab 9static char sccsid[] = "@(#)abort.c 5.11 (Berkeley) %G%";
84cb68a1 10#endif /* LIBC_SCCS and not lint */
0df78ea3 11
ba5d981c 12#include <sys/signal.h>
88792ef6
KB
13#include <stdlib.h>
14#include <stddef.h>
f0a345ab 15#include <unistd.h>
0df78ea3 16
fc85252d 17void
0df78ea3
RC
18abort()
19{
88792ef6
KB
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);
ba5d981c 29 (void)kill(getpid(), SIGABRT);
88792ef6
KB
30
31 /*
32 * if SIGABRT ignored, or caught and the handler returns, do
33 * it again, only harder.
34 */
8a376f64 35 (void)signal(SIGABRT, SIG_DFL);
88792ef6 36 (void)sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL);
8a376f64 37 (void)kill(getpid(), SIGABRT);
88792ef6 38 exit(1);
0df78ea3 39}