1 .\" Copyright (C) 2000 by Werner Almesberger
2 .\" May be distributed under GPL
4 .\" Written 2000-02-23 by Werner Almesberger
5 .\" Modified 2004-06-17 Michael Kerrisk <mtk.manpages@gmail.com>
7 .\" Japanese Version Copyright (c) 2000 NAKANO Takeo all rights reserved.
8 .\" Translated Wed Jun 14 2000 by NAKANO Takeo <nakano@apm.seikei.ac.jp>
10 .TH PIVOT_ROOT 2 2007-06-01 "Linux" "Linux Programmer's Manual"
12 .\"O pivot_root \- change the root file system
14 pivot_root \- root ファイルシステムを変更する
17 .BI "int pivot_root(const char *" new_root ", const char *" put_old );
20 .\"O .BR pivot_root ()
21 .\"O moves the root file system of the calling process to the
22 .\"O directory \fIput_old\fP and makes \fInew_root\fP the new root file system
23 .\"O of the calling process.
25 は呼び出し元のプロセスの root ファイルシステムを
29 を呼び出し元のプロセスの新しい root ファイルシステムにする。
32 .\"O .\" .B CAP_SYS_ADMIN
33 .\"O .\" capability is required.
38 .\"O The typical use of
39 .\"O .BR pivot_root ()
40 .\"O is during system startup, when the
41 .\"O system mounts a temporary root file system (e.g., an \fBinitrd\fP), then
42 .\"O mounts the real root file system, and eventually turns the latter into
43 .\"O the current root of all relevant processes or threads.
45 の典型的な利用法は、システムの起動中にシステムが一時的な
48 をマウントし、これに続いて本当の root ファイルシステムをマウントし、
50 カレント root に変更するような場合である。
52 .\"O .BR pivot_root ()
53 .\"O may or may not change the current root and the current
54 .\"O working directory of any processes or threads which use the old
57 .\"O .BR pivot_root ()
58 .\"O must ensure that processes with root or current working directory
59 .\"O at the old root operate correctly in either case.
60 .\"O An easy way to ensure this is to change their
61 .\"O root and current working directory to \fInew_root\fP before invoking
62 .\"O .BR pivot_root ().
63 古い root ディレクトリを使っていた全てのプロセスやスレッドの
64 カレント root とカレントワーキングディレクトリを、
68 の呼びだしプロセスは、古い root やカレントワーキングディレクトリを使っていた
69 プロセスが、いずれの場合でも正しく動作することを保証しなければならない。
70 これを簡単に行うには、それらのプロセスの root と
77 .\"O The paragraph above is intentionally vague because the implementation
79 .\"O .BR pivot_root ()
80 .\"O may change in the future.
81 .\"O At the time of writing,
82 .\"O .BR pivot_root ()
83 .\"O changes root and current working directory of each process or
84 .\"O thread to \fInew_root\fP if they point to the old root directory.
86 .\"O is necessary in order to prevent kernel threads from keeping the old
87 .\"O root directory busy with their root and current working directory,
88 .\"O even if they never access
89 .\"O the file system in any way.
90 .\"O In the future, there may be a mechanism for
91 .\"O kernel threads to explicitly relinquish any access to the file system,
92 .\"O such that this fairly intrusive mechanism can be removed from
93 .\"O .BR pivot_root ().
96 が変更されるかも知れないことを鑑みて、わざと曖昧に書いてある。
99 は古い root ディレクトリを用いている全てのプロセス・スレッドの root と
102 に変更する。これはカーネルのスレッドが古い root ディレクトリを
103 busy 状態にしないために必要である。これらのスレッドが
104 古いディレクトリを root やカレントワーキングディレクトリとしていると、
105 ファイルシステムに一切アクセスしない場合でも
106 古い root が busy になってしまうからである。
108 将来は、カーネルスレッドがあらゆるファイルシステムへのアクセスを
109 明示的に放棄するメカニズムができ、このでしゃばりな機能は
113 .\"O Note that this also applies to the calling process:
114 .\"O .BR pivot_root ()
116 .\"O or may not affect its current working directory.
117 .\"O It is therefore recommended to call
118 .\"O \fBchdir("/")\fP immediately after
119 .\"O .BR pivot_root ().
120 これは呼び出し元のプロセスについても当てはまることに注意。
122 がカレントプロセスのカレントワーキングディレクトリに影響するかどうかは
129 .\"O The following restrictions apply to \fInew_root\fP and \fIput_old\fP:
130 .IR new_root " および " put_old
133 .\"O They must be directories.
136 .\"O \fInew_root\fP and \fIput_old\fP must not be on the same file system as
137 .\"O the current root.
138 .IR new_root " と " put_old
139 は現在の root と同じファイルシステムにあってはならない。
141 .\"O \fIput_old\fP must be underneath \fInew_root\fP, that is, adding a nonzero
142 .\"O number of \fI/..\fP to the string pointed to by \fIput_old\fP must yield
143 .\"O the same directory as \fInew_root\fP.
144 .IR put_old " は " new_root
151 と同じディレクトリが得られなければならない。
153 .\"O No other file system may be mounted on \fIput_old\fP.
159 .\"O .BR pivot_root (8)
160 .\"O for additional usage examples.
165 .\"O If the current root is not a mount point (e.g., after
168 .\"O .BR pivot_root (),
169 .\"O see also below), not the old root directory, but the
170 .\"O mount point of that file system is mounted on \fIput_old\fP.
171 現在の root がマウントポイントではない
181 .\"O \fInew_root\fP does not have to be a mount point.
183 .\"O \fI/proc/mounts\fP will show the mount point of the file system containing
184 .\"O \fInew_root\fP as root (\fI/\fP).
193 とするファイルシステムのマウントポイントを表示する。
194 .\"O .SH "RETURN VALUE"
196 .\"O On success, zero is returned.
197 .\"O On error, \-1 is returned, and
198 .\"O \fIerrno\fP is set appropriately.
199 成功すると 0 を返す。エラーが起ると \-1 を返し、
204 .\"O .BR pivot_root ()
205 .\"O may return (in \fIerrno\fP) any of the errors returned by
207 .\"O Additionally, it may return:
213 に) 返す可能性がある。さらに以下を返すことがある:
216 .\"O \fInew_root\fP or \fIput_old\fP are on the current root file system,
217 .\"O or a file system is already mounted on \fIput_old\fP.
218 .IR new_root " または " put_old
219 が、現在の root ファイルシステム上にあるか、既に
221 になんらかのファイルシステムがマウントされている。
224 .\"O \fIput_old\fP is not underneath \fInew_root\fP.
225 .IR put_old " が " new_root
229 .\"O \fInew_root\fP or \fIput_old\fP is not a directory.
230 .IR new_root " または " put_old
234 .\"O The calling process does not have the
235 .\"O .B CAP_SYS_ADMIN
242 .\"O .BR pivot_root ()
243 .\"O was introduced in Linux 2.3.41.
245 は Linux 2.3.41 で導入された。
246 .\"O .SH "CONFORMING TO"
248 .\"O .BR pivot_root ()
249 .\"O is Linux-specific and hence is not portable.
251 は Linux に固有のものなので、移植性はない。
254 .\"O Glibc does not provide a wrapper for this system call; call it using
255 .\"O .BR syscall (2).
256 glibc はこのシステムコールに対するラッパー関数を提供していない。
261 .\"O .BR pivot_root ()
262 .\"O should not have to change root and current working directory of all other
263 .\"O processes in the system.
265 はシステムの他のプロセス全ての root と
266 カレントワーキングディレクトリとを変更しなくてもよいはずである。
268 .\"O Some of the more obscure uses of
269 .\"O .BR pivot_root ()
270 .\"O may quickly lead to
274 あっという間にわけのわからない状態になってしまうだろう