121338Sdist /* 224054Skarels * Copyright (c) 1985 Regents of the University of California. 335301Sbostic * All rights reserved. 435301Sbostic * 535301Sbostic * Redistribution and use in source and binary forms are permitted 635301Sbostic * provided that the above copyright notice and this paragraph are 735301Sbostic * duplicated in all such forms and that any documentation, 835301Sbostic * advertising materials, and other materials related to such 935301Sbostic * distribution and use acknowledge that the software was developed 1035301Sbostic * by the University of California, Berkeley. The name of the 1135301Sbostic * University may not be used to endorse or promote products derived 1235301Sbostic * from this software without specific prior written permission. 1335301Sbostic * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 1435301Sbostic * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 1535301Sbostic * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 1621338Sdist */ 1717866Sralph 1826540Sdonn #if defined(LIBC_SCCS) && !defined(lint) 19*42102Sbostic static char sccsid[] = "@(#)abort.c 5.8 (Berkeley) 05/16/90"; 2035301Sbostic #endif /* LIBC_SCCS and not lint */ 2121338Sdist 2242095Sbostic #include <sys/signal.h> 23*42102Sbostic #include <stdlib.h> 24*42102Sbostic #include <stddef.h> 2517866Sralph 2617866Sralph abort() 2717866Sralph { 28*42102Sbostic sigset_t mask; 29*42102Sbostic 30*42102Sbostic sigfillset(&mask); 31*42102Sbostic /* 32*42102Sbostic * don't block SIGABRT to give any handler a chance; we ignore 33*42102Sbostic * any errors -- X311J doesn't allow abort to return anyway. 34*42102Sbostic */ 35*42102Sbostic sigdelset(&mask, SIGABRT); 36*42102Sbostic (void)sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL); 3742095Sbostic (void)kill(getpid(), SIGABRT); 38*42102Sbostic 39*42102Sbostic /* 40*42102Sbostic * if SIGABRT ignored, or caught and the handler returns, do 41*42102Sbostic * it again, only harder. 42*42102Sbostic */ 4338790Skarels (void)signal(SIGABRT, SIG_DFL); 44*42102Sbostic (void)sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL); 4538790Skarels (void)kill(getpid(), SIGABRT); 46*42102Sbostic exit(1); 4717866Sralph } 48