os/ossrv/genericopenlibs/cstdlib/LPOSIX/ABORT.C
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/cstdlib/LPOSIX/ABORT.C	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,69 @@
     1.4 +/*
     1.5 +* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:
    1.18 +* FUNCTION
    1.19 +* <<abort>>---abnormal termination of a program
    1.20 +* INDEX
    1.21 +* abort
    1.22 +* ANSI_SYNOPSIS
    1.23 +* #include <stdlib.h>
    1.24 +* void abort(void);
    1.25 +* TRAD_SYNOPSIS
    1.26 +* #include <stdlib.h>
    1.27 +* void abort();
    1.28 +* Use <<abort>> to signal that your program has detected a condition it
    1.29 +* cannot deal with.  Normally, <<abort>> ends your program's execution.
    1.30 +* Before terminating your program, <<abort>> raises the exception <<SIGABRT>>
    1.31 +* (using `<<raise(SIGABRT)>>').  If you have used <<signal>> to register
    1.32 +* an exception handler for this condition, that handler has the
    1.33 +* opportunity to retain control, thereby avoiding program termination.
    1.34 +* In this implementation, <<abort>> does not perform any stream- or
    1.35 +* file-related cleanup (the host environment may do so; if not, you can
    1.36 +* arrange for your program to do its own cleanup with a <<SIGABRT>>
    1.37 +* exception handler).
    1.38 +* RETURNS
    1.39 +* <<abort>> does not return to its caller.
    1.40 +* PORTABILITY
    1.41 +* ANSI C requires <<abort>>.
    1.42 +* Supporting OS subroutines required: <<getpid>>, <<kill>>.
    1.43 +* 
    1.44 +*
    1.45 +*/
    1.46 +
    1.47 +
    1.48 +
    1.49 +
    1.50 +#include <unistd.h>		/* for definition of _exit() */
    1.51 +/* #include <signal.h> */
    1.52 +
    1.53 +EXPORT_C void
    1.54 +#ifdef EKA2
    1.55 +do_abort (void) _ATTRIBUTE((noreturn)) // Export in place of 'abort()' on EKA2 for binary compatibility.
    1.56 +#else
    1.57 +abort (void) _ATTRIBUTE((noreturn))
    1.58 +#endif
    1.59 +{
    1.60 +  for (;;)
    1.61 +    {
    1.62 +      /* raise (SIGABRT); */
    1.63 +      _exit (1);
    1.64 +    }
    1.65 +}
    1.66 +
    1.67 +#if (defined (__ARMCC__) || defined (__X86GCC__))
    1.68 +void abort (void) _ATTRIBUTE((noreturn))
    1.69 +	{
    1.70 +	do_abort();
    1.71 +	}
    1.72 +#endif