xref: /csrg-svn/lib/libc/stdlib/abort.c (revision 42095)
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*42095Sbostic static char sccsid[] = "@(#)abort.c	5.7 (Berkeley) 05/15/90";
2035301Sbostic #endif /* LIBC_SCCS and not lint */
2121338Sdist 
22*42095Sbostic #include <sys/signal.h>
2317866Sralph 
2417866Sralph abort()
2517866Sralph {
2635301Sbostic 	(void)sigblock(~0L);
27*42095Sbostic 	(void)sigsetmask(~sigmask(SIGABRT));
28*42095Sbostic 	/* leave catch function active to give program a crack at it */
29*42095Sbostic 	(void)kill(getpid(), SIGABRT);
30*42095Sbostic 	/* if we got here, it was no good; reset to default and stop */
3138790Skarels 	(void)signal(SIGABRT, SIG_DFL);
3238790Skarels 	(void)sigsetmask(~sigmask(SIGABRT));
3338790Skarels 	(void)kill(getpid(), SIGABRT);
3417866Sralph }
35