_exit.2: Clarify the distinction between the raw syscall and the wrapper function

Further clarify the difference between the raw _exit() system call
and the C library wrapper.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2021-08-30 23:36:42 +02:00
parent 44803dd03b
commit d99b5be0d8
1 changed files with 14 additions and 7 deletions

View File

@ -112,14 +112,14 @@ canceled upon
.BR _exit (),
is implementation-dependent.
.SS C library/kernel differences
In glibc up to version 2.3, the
.BR _exit ()
wrapper function invoked the kernel system call of the same name.
Since glibc 2.3, the wrapper function invokes
.BR exit_group (2),
in order to terminate all of the threads in a process.
The text above in DESCRIPTION describes the traditional effect of
.BR _exit (),
which is to terminate a process,
and these are the semantics specified by POSIIX.1 and implemented
by the C library wrapper function.
On modern systems, this means termination of all threads in the process.
.PP
The raw
By contrast with the C library wrapper function, the raw Linux
.BR _exit ()
system call terminates only the calling thread, and actions such as
reparenting child processes or sending
@ -127,6 +127,13 @@ reparenting child processes or sending
to the parent process are performed only if this is
the last thread in the thread group.
.\" _exit() is used by pthread_exit() to terminate the calling thread
.PP
In glibc up to version 2.3, the
.BR _exit ()
wrapper function invoked the kernel system call of the same name.
Since glibc 2.3, the wrapper function invokes
.BR exit_group (2),
in order to terminate all of the threads in a process.
.SH SEE ALSO
.BR execve (2),
.BR exit_group (2),