_EXIT

Section: System Calls (2)
Updated: August 1, 1992
Index Return to Main Contents
 

NAME

_exit - terminate a process  

SYNOPSIS

#include <stdlib.h>

int _exit(int status);
 

DESCRIPTION

The _exit function terminates a process with the following consequences:

All file descriptors and directory streams open in the calling process are closed. This may entail delays, for example, a process waiting for output to drain may not be killed, as it is already dying.

The parent process of the calling process receives a SIGCHLD signal, and when it executes a wait(2) or waitpid(2P) call (which it may already be suspended on), the exit status of the calling process is returned to it.

Children of the calling process aren't directly terminated. Child processes may receive a SIGHUP signal as described below for process groups. Otherwise, child processes are assigned the initialization process (whose process ID is 1) as their parent.

If the calling process is a controlling process, the SIGHUP signal is sent to each process in the foreground process group of the controlling terminal, and the calling process' controlling terminal is disassociated from the session, allowing it to be acquired by a new controlling process.

For BSD applications, all stopped children of the exiting process are restarted with a hangup signal (SIGHUP). For POSIX applications, if the exit of the calling process causes a process group to become orphaned, and if any member of the newly orphaned process group is stopped, then a SIGHUP signal followed by a SIGCONT signal is sent to each process in the newly orphaned process group.

Most C programs call the library routine exit(3), which performs cleanup actions in the standard I/O library before calling _exit.  

RETURN VALUE

This call never returns.  

SEE ALSO

fork(2), sigvec(2), wait(2), exit(3)


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 17:22:46 GMT, March 25, 2025