18f3e0d3aSdist /*
2*82f2451bSbostic * Copyright (c) 1985, 1993
3*82f2451bSbostic * The Regents of the University of California. All rights reserved.
4e73a4f49Sbostic *
5391bdf39Sbostic * %sccs.include.redist.c%
68f3e0d3aSdist */
78f3e0d3aSdist
805309d39Sdonn #if defined(LIBC_SCCS) && !defined(lint)
9*82f2451bSbostic static char sccsid[] = "@(#)abort.c 8.1 (Berkeley) 06/04/93";
10e73a4f49Sbostic #endif /* LIBC_SCCS and not lint */
1144353613Sralph
126cd39a0fSbostic #include <sys/signal.h>
1304c4ce86Sbostic #include <stdlib.h>
1404c4ce86Sbostic #include <stddef.h>
159c447d42Sdonn #include <unistd.h>
1644353613Sralph
174014ae98Sbostic void
abort()1844353613Sralph abort()
1944353613Sralph {
2004c4ce86Sbostic sigset_t mask;
2104c4ce86Sbostic
2204c4ce86Sbostic sigfillset(&mask);
2304c4ce86Sbostic /*
2404c4ce86Sbostic * don't block SIGABRT to give any handler a chance; we ignore
2504c4ce86Sbostic * any errors -- X311J doesn't allow abort to return anyway.
2604c4ce86Sbostic */
2704c4ce86Sbostic sigdelset(&mask, SIGABRT);
2804c4ce86Sbostic (void)sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL);
296cd39a0fSbostic (void)kill(getpid(), SIGABRT);
3004c4ce86Sbostic
3104c4ce86Sbostic /*
3204c4ce86Sbostic * if SIGABRT ignored, or caught and the handler returns, do
3304c4ce86Sbostic * it again, only harder.
3404c4ce86Sbostic */
3546158b3aSkarels (void)signal(SIGABRT, SIG_DFL);
3604c4ce86Sbostic (void)sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL);
3746158b3aSkarels (void)kill(getpid(), SIGABRT);
3804c4ce86Sbostic exit(1);
3944353613Sralph }
40