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 #include <picolibc.h>
36
37 #ifdef ABORT_PROVIDED
38
39 int _dummy_abort = 1;
40
41 #else
42
43 /*
44 FUNCTION
45 <<abort>>---abnormal termination of a program
46
47 INDEX
48 abort
49
50 SYNOPSIS
51 #include <stdlib.h>
52 void abort(void);
53
54 DESCRIPTION
55 Use <<abort>> to signal that your program has detected a condition it
56 cannot deal with. Normally, <<abort>> ends your program's execution.
57
58 Before terminating your program, <<abort>> raises the exception <<SIGABRT>>
59 (using `<<raise(SIGABRT)>>'). If you have used <<signal>> to register
60 an exception handler for this condition, that handler has the
61 opportunity to retain control, thereby avoiding program termination.
62
63 In this implementation, <<abort>> does not perform any stream- or
64 file-related cleanup (the host environment may do so; if not, you can
65 arrange for your program to do its own cleanup with a <<SIGABRT>>
66 exception handler).
67
68 RETURNS
69 <<abort>> does not return to its caller.
70
71 PORTABILITY
72 ANSI C requires <<abort>>.
73
74 Supporting OS subroutines required: <<_exit>> and optionally, <<write>>.
75 */
76
77 #include <stdlib.h>
78 #include <unistd.h>
79 #include <signal.h>
80
81 void
abort(void)82 abort (void)
83 {
84 #ifdef ABORT_MESSAGE
85 write (2, "Abort called\n", sizeof ("Abort called\n")-1);
86 #endif
87
88 while (1)
89 {
90 exit(1);
91 }
92 }
93 #endif
94