.\" Copyright (c) 1998 Andries Brouwer (aeb@cwi.nl), 24 September 1998 .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\" Modified, 27 May 2004, Michael Kerrisk .\" Added notes on capability requirements .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 1997 Ueyama Rui .\" all rights reserved. .\" Translated Mon Sep 29 23:21:04 JST 1997 .\" by Ueyama Rui .\" Updated & Modified Mon Mar 1 1999 .\" by NAKANO Takeo .\" Updated Sat Oct 11 JST 2003 by Kentaro Shirakata .\" .TH REBOOT 2 2019\-03\-06 Linux "Linux Programmer's Manual" .SH 名前 reboot \- 再起動する。または Ctrl\-Alt\-Delを有効・無効にする .SH 書式 /* カーネル 2.1.30 以降では、定数としてシンボリックな名前 LINUX_REBOOT_* が定義されており、呼び出しの第 4 引数として 指定することができる。*/ .PP \fB#include \fP .br \fB#include \fP .PP \fBint reboot(int \fP\fImagic\fP\fB, int \fP\fImagic2\fP\fB, int \fP\fIcmd\fP\fB, void *\fP\fIarg\fP\fB);\fP /* 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: */ .PP \fB#include \fP .br \fB#include \fP .PP \fBint reboot(int \fP\fIcmd\fP\fB);\fP .SH 説明 \fBreboot\fP() はシステムを再起動する。または再起動のキーストロークである Ctrl\-Alt\-Delete (CAD) を有効/無効にする。 このキーストロークは \fBloadkeys\fP(1) によって変更できる。 .PP \fImagic\fP が \fBLINUX_REBOOT_MAGIC1\fP (値は 0xfee1dead) であり、かつ \fImagic2\fP が \fBLINUX_REBOOT_MAGIC2\fP (672274793) でなければ、このシステムコールは (エラー \fBEINVAL\fP で) 失敗する。 しかし 2.1.17 からは \fBLINUX_REBOOT_MAGIC2A\fP (85072278) が、 また 2.1.97 からは \fBLINUX_REBOOT_MAGIC2B\fP (369367448) が、 2.5.71 からは \fBLINUX_REBOOT_MAGIC2C\fP (537993216) が \fImagic2\fP の値として指定できるようになった (これらの定数の 16 進での 表記にはちょっとした意味がある)。 .PP \fIcmd\fP 引数には以下の値を指定できる。 .TP \fBLINUX_REBOOT_CMD_CAD_OFF\fP (\fBRB_DISABLE_CAD\fP, 0) CAD を無効にする。 これ以降に CAD キーストロークが入力されると、 \fBSIGINT\fP シグナルが init (プロセス 1) に送られる。 このシグナルを受けると、おそらく init プロセスは 前もって定められた動作を行うことになる (多分すべてのプロセスの kill, sync, 再起動)。 .TP \fBLINUX_REBOOT_CMD_CAD_ON\fP (\fBRB_ENABLE_CAD\fP, 0x89abcdef) CAD を有効にする。 これ以降に CAD キーストロークが入力されると、 ただちに \fBLINUX_REBOOT_CMD_RESTART\fP に関連付けられた動作が行われるようになる。 .TP \fBLINUX_REBOOT_CMD_HALT\fP (\fBRB_HALT_SYSTEM\fP, 0xcdef0123; Linux 1.1.76 以降) "System halted." というメッセージが表示され、システムは停止 (halt) する。 制御は ROM モニタに移る (ROM モニタがある場合)。 先に \fBsync\fP(2) を行なわないと、データが失われる。 .TP \fBLINUX_REBOOT_CMD_KEXEC\fP (\fBRB_KEXEC\fP, 0x45584543, Linux 2.6.13 以降) \fBkexec_load\fP(2) を使って事前にロードされたカーネルを実行する。このオプションが利用できるのは、カーネルのコンフィグで \fBCONFIG_KEXEC\fP が有効になっている場合にのみである。 .TP \fBLINUX_REBOOT_CMD_POWER_OFF\fP (\fBRB_POWER_OFF\fP, 0x4321fedc; Linux 2.1.30 以降) "Power down" というメッセージが表示され、システムは停止 (stop) する。 可能な場合はシステムの電源が落とされる。 先に \fBsync\fP(2) を行なわないと、データが失われる。 .TP \fBLINUX_REBOOT_CMD_RESTART\fP (\fBRB_AUTOBOOT\fP, 0x1234567) "Restarting system." というメッセージが表示され、 デフォルトの再起動処理がただちに実行される。 先に \fBsync\fP(2) を行なわないと、データが失われる。 .TP \fBLINUX_REBOOT_CMD_RESTART2\fP (0xa1b2c3d4; Linux 2.1.30 以降) "Restarting system with command \(aq%s\(aq" というメッセージが表示され、 ただちに ( \fIarg\fP に指定されたコマンドを用いて) 再起動 (restart) が行われる。 先に \fBsync\fP(2) を行なわないと、データが失われる。 .TP \fBLINUX_REBOOT_CMD_SW_SUSPEND\fP (\fBRB_SW_SUSPEND\fP, 0xd000fce1; Linux 2.5.18 以降). システムがディスクにサスペンド (ハイバネーション) される。このオプションはカーネルで \fBCONFIG_HIBERNATION\fP が有効になっている場合にのみ利用できる。 .PP スーパーユーザーだけが \fBreboot\fP() を呼び出すことができる。 .PP .\" 上述のアクションの実際の効果はアーキテクチャーに依存する。 i386 アーキテクチャーでは、現在のところ (2.1.122) 付加引数は 何も行わないが、再起動のタイプをカーネルのコマンドライン引数 ("reboot=...") によって定めることができる。 これには warm または cold と、 hard または BIOS 経由の再起動を 設定できる。 .SS "PID 名前空間内での動作" .\" commit cf3f89214ef6a33fad60856bc5ffd7bb2fc4709b .\" see also commit 923c7538236564c46ee80c253a416705321f13e3 Since Linux 3.4, if \fBreboot\fP() is called from a PID namespace other than the initial PID namespace with one of the \fIcmd\fP 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 \fBpid_namespaces\fP(7). .PP The values that can be supplied in \fIcmd\fP when calling \fBreboot\fP() in this case are as follows: .TP \fBLINUX_REBOOT_CMD_RESTART\fP, \fBLINUX_REBOOT_CMD_RESTART2\fP The "init" process is terminated, and \fBwait\fP(2) in the parent process reports that the child was killed with a \fBSIGHUP\fP signal. .TP \fBLINUX_REBOOT_CMD_POWER_OFF\fP, \fBLINUX_REBOOT_CMD_HALT\fP The "init" process is terminated, and \fBwait\fP(2) in the parent process reports that the child was killed with a \fBSIGINT\fP signal. .PP For the other \fIcmd\fP values, \fBreboot\fP() returns \-1 and \fIerrno\fP is set to \fBEINVAL\fP. .SH 返り値 \fIcmd\fP がシステムの停止や再起動を表す値の場合、呼び出しが成功すると \fBreboot\fP() は返らない。 \fIcmd\fP が他の値の場合には、成功すると 0 が返る。 \fIcmd\fP の値に関わらず、失敗の場合には \-1 が返り、 \fIerrno\fP が適切に設定される。 .SH エラー .TP \fBEFAULT\fP \fBLINUX_REBOOT_CMD_RESTART2\fP の時にユーザースペースのデータの取得に問題があった。 .TP \fBEINVAL\fP magic の数字か \fIcmd\fP が間違っている。 .TP \fBEPERM\fP The calling process has insufficient privilege to call \fBreboot\fP(); the caller must have the \fBCAP_SYS_BOOT\fP inside its user namespace. .SH 準拠 \fBreboot\fP() は Linux に特有であり、移植を考慮したプログラムでは用いるべきではない。 .SH 関連項目 \fBsystemctl\fP(1), \fBsystemd\fP(1), \fBkexec_load\fP(2), \fBsync\fP(2), \fBbootparam\fP(7), \fBcapabilities\fP(7), \fBctrlaltdel\fP(8), \fBhalt\fP(8), \fBshutdown\fP(8) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は \%https://www.kernel.org/doc/man\-pages/ に書かれている。