Chapter Contents

Previous

Next
_exit

_exit



End Process and Skip Cleanup

Portability: POSIX.1 conforming, UNIX compatible


SYNOPSIS
DESCRIPTION
RETURN VALUE
EXAMPLE
RELATED FUNCTIONS


SYNOPSIS

#include <unistd.h>

void _exit(int status);


DESCRIPTION

_exit ends the current process. status is the return status for the process.

_exit closes open file descriptors and directory streams in the calling process. If the parent of the calling process is suspended by wait or waitpid , the low-order eight bits of status are available to the parent. Otherwise, the parent process saves the value of status to return to the parent in the event of wait or waitpid . A SIGCHLD signal is sent to the parent process.

_exit does not directly terminate child processes. Child processes that continue after the parent process ends receive a new parent process ID of 1.

_exit does not perform C run-time library cleanup; standard I/O stream buffers are not flushed, and atexit routines are not called.


RETURN VALUE

_exit is always successful. It does not return a value.


EXAMPLE

The following code fragment illustrates the use of _exit :

#include <unistd.h>
#include <stdio.h>

.
.
.

fflush(NULL);
_exit(0);

.
.
.


RELATED FUNCTIONS

exit


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.