reboot.2: Fix bogus description of reboot() from non-initial PID namespace

The current text was confused (mea culpa). No signal is sent to
the init() process. Rather, depending on the 'cmd' given to
reboot(), the 'group_exit_code' value will set to either SIGHUP or
SIGINT, with the effect that one of those signals is reported to
wait() in the parent process.

See https://bugzilla.kernel.org/show_bug.cgi?id=195899

Reported-by: Michał Zegan <webczat_200@poczta.onet.pl>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2017-09-24 11:06:04 +02:00
parent ce08dedca4
commit ac0c9466d6
1 changed files with 35 additions and 19 deletions

View File

@ -162,34 +162,50 @@ For the i386 architecture, the additional argument does not do
anything at present (2.1.122), but the type of reboot can be
determined by kernel command-line arguments ("reboot=...") to be
either warm or cold, and either hard or through the BIOS.
.\"
.SS Behavior inside PID namespaces
.\" commit cf3f89214ef6a33fad60856bc5ffd7bb2fc4709b
.\" see also commit 923c7538236564c46ee80c253a416705321f13e3
Since Linux 3.4, when
Since Linux 3.4,
if
.BR reboot ()
is called from a PID namespace (see
.BR pid_namespaces (7))
other than the initial PID namespace,
the effect of the call is to send a signal to the namespace "init" process.
The
.BR LINUX_REBOOT_CMD_RESTART
and
.BR LINUX_REBOOT_CMD_RESTART2
is called
from a PID namespace other than the initial PID namespace
with one of the
.I cmd
values cause a
.BR SIGHUP
signal to be sent.
The
.BR LINUX_REBOOT_CMD_POWER_OFF
and
.BR LINUX_REBOOT_CMD_HALT
values listed below,
it performs a "reboot" of that namespace:
the "init" process of the PID namespace is immediately terminated,
with the effects described in
.BR pid_namespaces (7).
.PP
The values that can be supplied in
.I cmd
values cause a
when calling
.BR reboot ()
in this case are as follows:
.TP
.BR LINUX_REBOOT_CMD_RESTART ", " LINUX_REBOOT_CMD_RESTART2
The "init" process is terminated,
and
.BR wait (2)
in the parent process reports that the child was killed with a
.B SIGHUP
signal.
.TP
.BR LINUX_REBOOT_CMD_POWER_OFF ", " LINUX_REBOOT_CMD_HALT
The "init" process is terminated,
and
.BR wait (2)
in the parent process reports that the child was killed with a
.B SIGINT
signal to be sent.
signal.
.PP
For the other
.I cmd
values, \-1 is returned and
values,
.BR reboot ()
returns \-1 and
.I errno
is set to
.BR EINVAL .