.\"
.TH PIVOT_ROOT 2 2012\-07\-13 Linux "Linux Programmer's Manual"
.SH 名前
-pivot_root \- change the root filesystem
+pivot_root \- root ファイルシステムを変更する
.SH 書式
\fBint pivot_root(const char *\fP\fInew_root\fP\fB, const char *\fP\fIput_old\fP\fB);\fP
.\" The
.\" .B CAP_SYS_ADMIN
.\" capability is required.
-\fBpivot_root\fP() moves the root filesystem of the calling process to the
-directory \fIput_old\fP and makes \fInew_root\fP the new root filesystem of the
-calling process.
+\fBpivot_root\fP() は呼び出し元のプロセスの root ファイルシステムを \fIput_old\fP ディレクトリに移動し、
+\fInew_root\fP を呼び出し元のプロセスの新しい root ファイルシステムにする。
-The typical use of \fBpivot_root\fP() is during system startup, when the
-system mounts a temporary root filesystem (e.g., an \fBinitrd\fP), then mounts
-the real root filesystem, and eventually turns the latter into the current
-root of all relevant processes or threads.
+\fBpivot_root\fP() の典型的な利用法は、システムの起動中にシステムが一時的な root ファイルシステム (例えば \fBinitrd\fP)
+をマウントし、これに続いて本当の root ファイルシステムをマウントし、 後者を必要な全てのプロセス・スレッドの カレント root
+に変更するような場合である。
古い root ディレクトリを使っていた全てのプロセスやスレッドの カレント root とカレントワーキングディレクトリを、
\fBpivot_root\fP() が変更するかどうかはわからない。 \fBpivot_root\fP() の呼びだしプロセスは、古い root
これを簡単に行うには、それらのプロセスの root と カレントワーキングディレクトリを \fBpivot_root\fP() を呼び出す前に
\fInew_root\fP に変更しておくことである。
-The paragraph above is intentionally vague because the implementation of
-\fBpivot_root\fP() may change in the future. At the time of writing,
-\fBpivot_root\fP() changes root and current working directory of each process
-or thread to \fInew_root\fP if they point to the old root directory. This is
-necessary in order to prevent kernel threads from keeping the old root
-directory busy with their root and current working directory, even if they
-never access the filesystem in any way. In the future, there may be a
-mechanism for kernel threads to explicitly relinquish any access to the
-filesystem, such that this fairly intrusive mechanism can be removed from
-\fBpivot_root\fP().
+上記の段落は、将来 \fBpivot_root\fP() が変更されるかも知れないことを鑑みて、わざと曖昧に書いてある。 本ページを記述している時点では、
+\fBpivot_root\fP() は古い root ディレクトリを用いている全てのプロセス・スレッドの root と カレントワーキングディレクトリを
+\fInew_root\fP に変更する。これはカーネルのスレッドが古い root ディレクトリを busy 状態にしないために必要である。これらのスレッドが
+古いディレクトリを root やカレントワーキングディレクトリとしていると、 ファイルシステムに一切アクセスしない場合でも 古い root が busy
+になってしまうからである。 将来は、カーネルスレッドがあらゆるファイルシステムへのアクセスを 明示的に放棄するメカニズムができ、このでしゃばりな機能は
+\fBpivot_root\fP() から削除されるかもしれない。
これは呼び出し元のプロセスについても当てはまることに注意。 \fBpivot_root\fP()
がカレントプロセスのカレントワーキングディレクトリに影響するかどうかは 分からない。したがって \fBpivot_root\fP() の直後に
.IP \- 3
ディレクトリでなければならない。
.IP \- 3
-\fInew_root\fP and \fIput_old\fP must not be on the same filesystem as the current
-root.
+\fInew_root\fP と \fIput_old\fP は現在の root と同じファイルシステムにあってはならない。
.IP \- 3
\fIput_old\fP は \fInew_root\fP 以下になければならない。すなわち \fIput_old\fP を差す文字列に 1 個以上の \fI../\fP
を付けることによって \fInew_root\fP と同じディレクトリが得られなければならない。
.IP \- 3
-No other filesystem may be mounted on \fIput_old\fP.
+他のファイルシステムが \fIput_old\fP にマウントされていてはならない。
.PP
利用例については \fBpivot_root\fP(8) を参照のこと。
-If the current root is not a mount point (e.g., after \fBchroot\fP(2) or
-\fBpivot_root\fP(), see also below), not the old root directory, but the mount
-point of that filesystem is mounted on \fIput_old\fP.
+現在の root がマウントポイントではない (\fBchroot\fP(2) や \fBpivot_root\fP() の後など。以下も参照) 場合、 古い
+root ディレクトリではなく、 そのファイルシステムのマウントポイントが \fIput_old\fP にマウントされる。
-\fInew_root\fP does not have to be a mount point. In this case,
-\fI/proc/mounts\fP will show the mount point of the filesystem containing
-\fInew_root\fP as root (\fI/\fP).
+\fInew_root\fP はマウントポイントでなくてもよい。 この場合 \fI/proc/mounts\fP は、 \fInew_root\fP を root
+(\fI/\fP) とするファイルシステムのマウントポイントを表示する。
.SH 返り値
成功した場合は 0 が返される。エラーの場合は \-1 が返され、 \fIerrno\fP が適切に設定される。
.SH エラー
返す可能性がある。さらに以下を返すことがある:
.TP
\fBEBUSY\fP
-\fInew_root\fP or \fIput_old\fP are on the current root filesystem, or a
-filesystem is already mounted on \fIput_old\fP.
+\fInew_root\fP または \fIput_old\fP が、現在の root ファイルシステム上にあるか、既に \fIput_old\fP
+になんらかのファイルシステムがマウントされている。
.TP
\fBEINVAL\fP
\fIput_old\fP が \fInew_root\fP の下層にない。