[Previous] [Contents] [Index] [Next]

Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

abort()

Raise the SIGABRT signal to terminate program execution

Synopsis:

#include <stdlib.h>

void abort( void );

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The abort() function causes abnormal process termination to occur, unless the signal SIGABRT is caught and the signal handler doesn't return. The status unsuccessful termination is returned to the invoking process by means means of the function call raise(SIGABRT).

Under QNX Neutrino, the unsuccessful termination status value is 6.

Returns:

The abort() function doesn't return to its caller.

Examples:

#include <stdlib.h>

int main( void )
{
    int major_error = 1;

    if( major_error )
        abort();

    /* You'll never get here. */
    return EXIT_SUCCESS;
}

Classification:

ANSI, POSIX 1003.1

Safety:
Cancellation point No
Interrupt handler No
Signal handler Read the Caveats
Thread Yes

Caveats:

A strictly-conforming POSIX application can't assume that the abort() function is safe to use in a signal handler on other platforms.

See also:

atexit(), close(), execl(), execle(), execlp(), execlpe(), execv(), execve(), execvp(), execvpe(), _exit(), exit(), getenv(), main(), putenv(), sigaction(), signal(), spawn*() functions, system(), wait(), waitpid()


[Previous] [Contents] [Index] [Next]