|
1 /* |
|
2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * FUNCTION |
|
16 * <<abort>>---abnormal termination of a program |
|
17 * INDEX |
|
18 * abort |
|
19 * ANSI_SYNOPSIS |
|
20 * #include <stdlib.h> |
|
21 * void abort(void); |
|
22 * TRAD_SYNOPSIS |
|
23 * #include <stdlib.h> |
|
24 * void abort(); |
|
25 * Use <<abort>> to signal that your program has detected a condition it |
|
26 * cannot deal with. Normally, <<abort>> ends your program's execution. |
|
27 * Before terminating your program, <<abort>> raises the exception <<SIGABRT>> |
|
28 * (using `<<raise(SIGABRT)>>'). If you have used <<signal>> to register |
|
29 * an exception handler for this condition, that handler has the |
|
30 * opportunity to retain control, thereby avoiding program termination. |
|
31 * In this implementation, <<abort>> does not perform any stream- or |
|
32 * file-related cleanup (the host environment may do so; if not, you can |
|
33 * arrange for your program to do its own cleanup with a <<SIGABRT>> |
|
34 * exception handler). |
|
35 * RETURNS |
|
36 * <<abort>> does not return to its caller. |
|
37 * PORTABILITY |
|
38 * ANSI C requires <<abort>>. |
|
39 * Supporting OS subroutines required: <<getpid>>, <<kill>>. |
|
40 * |
|
41 * |
|
42 */ |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 #include <stdlib.h> |
|
48 #include <unistd.h> /* for definition of _exit() */ |
|
49 /* #include <signal.h> */ |
|
50 |
|
51 EXPORT_C void |
|
52 #ifdef EKA2 |
|
53 do_abort (void) _ATTRIBUTE((noreturn)) // Export in place of 'abort()' on EKA2 for binary compatibility. |
|
54 #else |
|
55 abort (void) _ATTRIBUTE((noreturn)) |
|
56 #endif |
|
57 { |
|
58 for (;;) |
|
59 { |
|
60 /* raise (SIGABRT); */ |
|
61 _exit (1); |
|
62 } |
|
63 } |
|
64 |
|
65 #if (defined (__ARMCC__) || defined (__X86GCC__)) |
|
66 void abort (void) _ATTRIBUTE((noreturn)) |
|
67 { |
|
68 do_abort(); |
|
69 } |
|
70 #endif |