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