os/ossrv/genericopenlibs/cstdlib/LPOSIX/ABORT.C
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 <unistd.h>		/* for definition of _exit() */
    48 /* #include <signal.h> */
    49 
    50 EXPORT_C void
    51 #ifdef EKA2
    52 do_abort (void) _ATTRIBUTE((noreturn)) // Export in place of 'abort()' on EKA2 for binary compatibility.
    53 #else
    54 abort (void) _ATTRIBUTE((noreturn))
    55 #endif
    56 {
    57   for (;;)
    58     {
    59       /* raise (SIGABRT); */
    60       _exit (1);
    61     }
    62 }
    63 
    64 #if (defined (__ARMCC__) || defined (__X86GCC__))
    65 void abort (void) _ATTRIBUTE((noreturn))
    66 	{
    67 	do_abort();
    68 	}
    69 #endif