#include <unistd.h> void _exit(int status);
_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.
_exit
is always successful. It does not return a value.
_exit
:
#include <unistd.h> #include <stdio.h> . . . fflush(NULL); _exit(0); . . .
exit
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.