1 /*
2 Copyright (c) 1990 Regents of the University of California.
3 All rights reserved.
4 */
5 /* NetWare can not use this implementation of abort. It provides its
6 own version of abort in clib.nlm. If we can not use clib.nlm, then
7 we must write abort in sys/netware. */
8
9 #ifdef ABORT_PROVIDED
10
11 int _dummy_abort = 1;
12
13 #else
14
15 /*
16 FUNCTION
17 <<abort>>---abnormal termination of a program
18
19 INDEX
20 abort
21
22 SYNOPSIS
23 #include <stdlib.h>
24 void abort(void);
25
26 DESCRIPTION
27 Use <<abort>> to signal that your program has detected a condition it
28 cannot deal with. Normally, <<abort>> ends your program's execution.
29
30 Before terminating your program, <<abort>> raises the exception <<SIGABRT>>
31 (using `<<raise(SIGABRT)>>'). If you have used <<signal>> to register
32 an exception handler for this condition, that handler has the
33 opportunity to retain control, thereby avoiding program termination.
34
35 In this implementation, <<abort>> does not perform any stream- or
36 file-related cleanup (the host environment may do so; if not, you can
37 arrange for your program to do its own cleanup with a <<SIGABRT>>
38 exception handler).
39
40 RETURNS
41 <<abort>> does not return to its caller.
42
43 PORTABILITY
44 ANSI C requires <<abort>>.
45
46 Supporting OS subroutines required: <<_exit>> and optionally, <<write>>.
47 */
48
49 #include <stdlib.h>
50 #include <unistd.h>
51 #include <signal.h>
52
53 void
abort(void)54 abort (void)
55 {
56 #ifdef ABORT_MESSAGE
57 write (2, "Abort called\n", sizeof ("Abort called\n")-1);
58 #endif
59
60 while (1)
61 {
62 raise (SIGABRT);
63 _exit (1);
64 }
65 }
66
67 #endif
68