]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man2/reboot.2
fuse.4: ffix
[thirdparty/man-pages.git] / man2 / reboot.2
index 7521d529a4580e1a5e1345962340a9f38f9f4ae1..20a7ca44ff62abd76db44f5fa81d7ba2607fdf32 100644 (file)
 .\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
 .\"     Added notes on capability requirements
 .\"
-.TH REBOOT 2 2016-10-08 "Linux" "Linux Programmer's Manual"
+.TH REBOOT 2 2017-09-15 "Linux" "Linux Programmer's Manual"
 .SH NAME
 reboot \- reboot or enable/disable Ctrl-Alt-Del
 .SH SYNOPSIS
-/* For libc4 and libc5 the library call and the system call
-   are identical, and since kernel version 2.1.30 there are
-   symbolic names LINUX_REBOOT_* for the constants and a
-   fourth argument to the call: */
-.sp
+/* Since kernel version 2.1.30 there are symbolic names LINUX_REBOOT_*
+   for the constants and a fourth argument to the call: */
+.PP
 .B #include <unistd.h>
 .br
 .B #include <linux/reboot.h>
-.sp
+.PP
 .BI "int reboot(int " magic ", int " magic2 ", int " cmd ", void *" arg );
-.sp
+
 /* Under glibc and most alternative libc's (including uclibc, dietlibc,
    musl and a few others), some of the constants involved have gotten
    symbolic names RB_*, and the library call is a 1-argument
    wrapper around the system call: */
-.sp
+.PP
 .B #include <unistd.h>
 .br
 .B #include <sys/reboot.h>
-.sp
+.PP
 .BI "int reboot(int " cmd );
 .SH DESCRIPTION
 The
@@ -58,7 +56,7 @@ call reboots the system, or enables/disables the reboot keystroke
 it can be changed using
 .BR loadkeys (1)).
 .PP
-This system call will fail (with
+This system call fails (with the error
 .BR EINVAL )
 unless
 .I magic
@@ -81,7 +79,7 @@ and since 2.5.71 also
 are permitted as values for
 .IR magic2 .
 (The hexadecimal values of these constants are meaningful.)
-
+.PP
 The
 .I cmd
 argument can have the following values:
@@ -155,43 +153,59 @@ data will be lost.
 The system is suspended (hibernated) to disk.
 This option is available only if the kernel was configured with
 .BR CONFIG_HIBERNATION .
-.LP
+.PP
 Only the superuser may call
 .BR reboot ().
-.LP
+.PP
 The precise effect of the above actions depends on the architecture.
 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 .
@@ -228,10 +242,12 @@ inside its user namespace.
 is Linux-specific,
 and should not be used in programs intended to be portable.
 .SH SEE ALSO
+.BR systemctl (1),
+.BR systemd (1),
 .BR kexec_load (2),
 .BR sync (2),
 .BR bootparam (7),
 .BR capabilities (7),
 .BR ctrlaltdel (8),
 .BR halt (8),
-.BR reboot (8)
+.BR shutdown (8)