1 /*
2 Copyright (c) 2001, 2009 Xilinx, Inc.  All rights reserved.
3 
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions are
6 met:
7 
8 1.  Redistributions source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
10 
11 2.  Redistributions in binary form must reproduce the above copyright
12 notice, this list of conditions and the following disclaimer in the
13 documentation and/or other materials provided with the distribution.
14 
15 3.  Neither the name of Xilinx nor the names of its contributors may be
16 used to endorse or promote products derived from this software without
17 specific prior written permission.
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
20 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
25 TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 /* NetWare can not use this implementation of abort.  It provides its
32    own version of abort in clib.nlm.  If we can not use clib.nlm, then
33    we must write abort in sys/netware.  */
34 
35 #ifdef ABORT_PROVIDED
36 
37 int _dummy_abort = 1;
38 
39 #else
40 
41 /*
42 FUNCTION
43 <<abort>>---abnormal termination of a program
44 
45 INDEX
46 	abort
47 
48 SYNOPSIS
49 	#include <stdlib.h>
50 	void abort(void);
51 
52 DESCRIPTION
53 Use <<abort>> to signal that your program has detected a condition it
54 cannot deal with.  Normally, <<abort>> ends your program's execution.
55 
56 Before terminating your program, <<abort>> raises the exception <<SIGABRT>>
57 (using `<<raise(SIGABRT)>>').  If you have used <<signal>> to register
58 an exception handler for this condition, that handler has the
59 opportunity to retain control, thereby avoiding program termination.
60 
61 In this implementation, <<abort>> does not perform any stream- or
62 file-related cleanup (the host environment may do so; if not, you can
63 arrange for your program to do its own cleanup with a <<SIGABRT>>
64 exception handler).
65 
66 RETURNS
67 <<abort>> does not return to its caller.
68 
69 PORTABILITY
70 ANSI C requires <<abort>>.
71 
72 Supporting OS subroutines required: <<_exit>> and optionally, <<write>>.
73 */
74 
75 #include <stdlib.h>
76 #include <unistd.h>
77 #include <signal.h>
78 
79 void
abort(void)80 abort (void)
81 {
82 #ifdef ABORT_MESSAGE
83   write (2, "Abort called\n", sizeof ("Abort called\n")-1);
84 #endif
85 
86   while (1)
87     {
88       exit(1);
89     }
90 }
91 #endif