.TH PIVOT_ROOT 2 2007-06-01 "Linux" "Linux Programmer's Manual"
.\"O .SH NAME
.\"O pivot_root \- change the root file system
-.SH ̾Á°
-pivot_root \- root ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤òÊѹ¹¤¹¤ë
+.SH 名前
+pivot_root \- root ファイルシステムを変更する
.\"O .SH SYNOPSIS
-.SH ½ñ¼°
+.SH 書式
.BI "int pivot_root(const char *" new_root ", const char *" put_old );
.\"O .SH DESCRIPTION
-.SH ÀâÌÀ
+.SH 説明
.\"O .BR pivot_root ()
.\"O moves the root file system of the calling process to the
.\"O directory \fIput_old\fP and makes \fInew_root\fP the new root file system
.\"O of the calling process.
.BR pivot_root ()
-¤Ï¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤Î root ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤ò
+は呼び出し元のプロセスの root ファイルシステムを
.I put_old
-¥Ç¥£¥ì¥¯¥È¥ê¤Ë°ÜÆ°¤·¡¢
+ディレクトリに移動し、
.I new_root
-¤ò¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤Î¿·¤·¤¤ root ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Ë¤¹¤ë¡£
+を呼び出し元のプロセスの新しい root ファイルシステムにする。
.\"O .\"
.\"O .\" The
.\"O .\" .B CAP_SYS_ADMIN
.\"O .\" capability is required.
.\"
.\" .B CAP_SYS_ADMIN
-.\" ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤¬É¬ÍפǤ¢¤ë¡£
+.\" ケーパビリティが必要である。
.\"O The typical use of
.\"O .BR pivot_root ()
.\"O mounts the real root file system, and eventually turns the latter into
.\"O the current root of all relevant processes or threads.
.BR pivot_root ()
-¤Îŵ·¿Åª¤ÊÍøÍÑË¡¤Ï¡¢¥·¥¹¥Æ¥à¤Îµ¯Æ°Ãæ¤Ë¥·¥¹¥Æ¥à¤¬°ì»þŪ¤Ê
-root ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à (Î㤨¤Ð
+の典型的な利用法は、システムの起動中にシステムが一時的な
+root ファイルシステム (例えば
.BR initrd )
-¤ò¥Þ¥¦¥ó¥È¤·¡¢¤³¤ì¤Ë³¤¤¤ÆËÜÅö¤Î root ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤ò¥Þ¥¦¥ó¥È¤·¡¢
-¸å¼Ô¤òɬÍפÊÁ´¤Æ¤Î¥×¥í¥»¥¹¡¦¥¹¥ì¥Ã¥É¤Î
-¥«¥ì¥ó¥È root ¤ËÊѹ¹¤¹¤ë¤è¤¦¤Ê¾ì¹ç¤Ç¤¢¤ë¡£
+をマウントし、これに続いて本当の root ファイルシステムをマウントし、
+後者を必要な全てのプロセス・スレッドの
+カレント root に変更するような場合である。
.\"O .BR pivot_root ()
.\"O may or may not change the current root and the current
.\"O An easy way to ensure this is to change their
.\"O root and current working directory to \fInew_root\fP before invoking
.\"O .BR pivot_root ().
-¸Å¤¤ root ¥Ç¥£¥ì¥¯¥È¥ê¤ò»È¤Ã¤Æ¤¤¤¿Á´¤Æ¤Î¥×¥í¥»¥¹¤ä¥¹¥ì¥Ã¥É¤Î
-¥«¥ì¥ó¥È root ¤È¥«¥ì¥ó¥È¥ï¡¼¥¥ó¥°¥Ç¥£¥ì¥¯¥È¥ê¤ò¡¢
+古い root ディレクトリを使っていた全てのプロセスやスレッドの
+カレント root とカレントワーキングディレクトリを、
.BR pivot_root ()
-¤¬Êѹ¹¤¹¤ë¤«¤É¤¦¤«¤Ï¤ï¤«¤é¤Ê¤¤¡£
+が変更するかどうかはわからない。
.BR pivot_root ()
-¤Î¸Æ¤Ó¤À¤·¥×¥í¥»¥¹¤Ï¡¢¸Å¤¤ root ¤ä¥«¥ì¥ó¥È¥ï¡¼¥¥ó¥°¥Ç¥£¥ì¥¯¥È¥ê¤ò»È¤Ã¤Æ¤¤¤¿
-¥×¥í¥»¥¹¤¬¡¢¤¤¤º¤ì¤Î¾ì¹ç¤Ç¤âÀµ¤·¤¯Æ°ºî¤¹¤ë¤³¤È¤òÊݾڤ·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
-¤³¤ì¤ò´Êñ¤Ë¹Ô¤¦¤Ë¤Ï¡¢¤½¤ì¤é¤Î¥×¥í¥»¥¹¤Î root ¤È
-¥«¥ì¥ó¥È¥ï¡¼¥¥ó¥°¥Ç¥£¥ì¥¯¥È¥ê¤ò
+の呼びだしプロセスは、古い root やカレントワーキングディレクトリを使っていた
+プロセスが、いずれの場合でも正しく動作することを保証しなければならない。
+これを簡単に行うには、それらのプロセスの root と
+カレントワーキングディレクトリを
.BR pivot_root ()
-¤ò¸Æ¤Ó½Ð¤¹Á°¤Ë
+を呼び出す前に
.I new_root
-¤ËÊѹ¹¤·¤Æ¤ª¤¯¤³¤È¤Ç¤¢¤ë¡£
+に変更しておくことである。
.\"O The paragraph above is intentionally vague because the implementation
.\"O of
.\"O kernel threads to explicitly relinquish any access to the file system,
.\"O such that this fairly intrusive mechanism can be removed from
.\"O .BR pivot_root ().
-¾åµ¤ÎÃÊÍî¤Ï¡¢¾Íè
+上記の段落は、将来
.BR pivot_root ()
-¤¬Êѹ¹¤µ¤ì¤ë¤«¤âÃΤì¤Ê¤¤¤³¤È¤ò´Õ¤ß¤Æ¡¢¤ï¤¶¤ÈÛ£Ëæ¤Ë½ñ¤¤¤Æ¤¢¤ë¡£
-ËÜ¥Ú¡¼¥¸¤òµ½Ò¤·¤Æ¤¤¤ë»þÅÀ¤Ç¤Ï¡¢
+が変更されるかも知れないことを鑑みて、わざと曖昧に書いてある。
+本ページを記述している時点では、
.BR pivot_root ()
-¤Ï¸Å¤¤ root ¥Ç¥£¥ì¥¯¥È¥ê¤òÍѤ¤¤Æ¤¤¤ëÁ´¤Æ¤Î¥×¥í¥»¥¹¡¦¥¹¥ì¥Ã¥É¤Î root ¤È
-¥«¥ì¥ó¥È¥ï¡¼¥¥ó¥°¥Ç¥£¥ì¥¯¥È¥ê¤ò
+は古い root ディレクトリを用いている全てのプロセス・スレッドの root と
+カレントワーキングディレクトリを
.I new_root
-¤ËÊѹ¹¤¹¤ë¡£¤³¤ì¤Ï¥«¡¼¥Í¥ë¤Î¥¹¥ì¥Ã¥É¤¬¸Å¤¤ root ¥Ç¥£¥ì¥¯¥È¥ê¤ò
-busy ¾õÂ֤ˤ·¤Ê¤¤¤¿¤á¤ËɬÍפǤ¢¤ë¡£¤³¤ì¤é¤Î¥¹¥ì¥Ã¥É¤¬
-¸Å¤¤¥Ç¥£¥ì¥¯¥È¥ê¤ò root ¤ä¥«¥ì¥ó¥È¥ï¡¼¥¥ó¥°¥Ç¥£¥ì¥¯¥È¥ê¤È¤·¤Æ¤¤¤ë¤È¡¢
-¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Ë°ìÀÚ¥¢¥¯¥»¥¹¤·¤Ê¤¤¾ì¹ç¤Ç¤â
-¸Å¤¤ root ¤¬ busy ¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤¦¤«¤é¤Ç¤¢¤ë¡£
-.\"nakano: ¤Á¤È¾éĹ...
-¾Íè¤Ï¡¢¥«¡¼¥Í¥ë¥¹¥ì¥Ã¥É¤¬¤¢¤é¤æ¤ë¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Ø¤Î¥¢¥¯¥»¥¹¤ò
-ÌÀ¼¨Åª¤ËÊü´þ¤¹¤ë¥á¥«¥Ë¥º¥à¤¬¤Ç¤¡¢¤³¤Î¤Ç¤·¤ã¤Ð¤ê¤Êµ¡Ç½¤Ï
+に変更する。これはカーネルのスレッドが古い root ディレクトリを
+busy 状態にしないために必要である。これらのスレッドが
+古いディレクトリを root やカレントワーキングディレクトリとしていると、
+ファイルシステムに一切アクセスしない場合でも
+古い root が busy になってしまうからである。
+.\"nakano: ちと冗長...
+将来は、カーネルスレッドがあらゆるファイルシステムへのアクセスを
+明示的に放棄するメカニズムができ、このでしゃばりな機能は
.BR pivot_root ()
-¤«¤éºï½ü¤µ¤ì¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
+から削除されるかもしれない。
.\"O Note that this also applies to the calling process:
.\"O .BR pivot_root ()
.\"O It is therefore recommended to call
.\"O \fBchdir("/")\fP immediately after
.\"O .BR pivot_root ().
-¤³¤ì¤Ï¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤Ë¤Ä¤¤¤Æ¤âÅö¤Æ¤Ï¤Þ¤ë¤³¤È¤ËÃí°Õ¡£
+これは呼び出し元のプロセスについても当てはまることに注意。
.BR pivot_root ()
-¤¬¥«¥ì¥ó¥È¥×¥í¥»¥¹¤Î¥«¥ì¥ó¥È¥ï¡¼¥¥ó¥°¥Ç¥£¥ì¥¯¥È¥ê¤Ë±Æ¶Á¤¹¤ë¤«¤É¤¦¤«¤Ï
-ʬ¤«¤é¤Ê¤¤¡£¤·¤¿¤¬¤Ã¤Æ
+がカレントプロセスのカレントワーキングディレクトリに影響するかどうかは
+分からない。したがって
.BR pivot_root ()
-¤Îľ¸å¤Ë
+の直後に
.B chdir("/")
-¤ò¸Æ¤Ó½Ð¤¹¤È¤è¤¤¡£
+を呼び出すとよい。
.\"O The following restrictions apply to \fInew_root\fP and \fIput_old\fP:
-.IR new_root " ¤ª¤è¤Ó " put_old
-¤Ë¤Ï°Ê²¼¤ÎÀ©¸Â¤¬¤¢¤ë:
+.IR new_root " および " put_old
+には以下の制限がある:
.IP \- 3
.\"O They must be directories.
-¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+ディレクトリでなければならない。
.IP \- 3
.\"O \fInew_root\fP and \fIput_old\fP must not be on the same file system as
.\"O the current root.
-.IR new_root " ¤È " put_old
-¤Ï¸½ºß¤Î root ¤ÈƱ¤¸¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Ë¤¢¤Ã¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
+.IR new_root " と " put_old
+は現在の root と同じファイルシステムにあってはならない。
.IP \- 3
.\"O \fIput_old\fP must be underneath \fInew_root\fP, that is, adding a nonzero
.\"O number of \fI/..\fP to the string pointed to by \fIput_old\fP must yield
.\"O the same directory as \fInew_root\fP.
-.IR put_old " ¤Ï " new_root
-°Ê²¼¤Ë¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£¤¹¤Ê¤ï¤Á
+.IR put_old " は " new_root
+以下になければならない。すなわち
.I put_old
-¤òº¹¤¹Ê¸»úÎó¤Ë 1 ¸Ä°Ê¾å¤Î
+を差す文字列に 1 個以上の
.I ../
-¤òÉÕ¤±¤ë¤³¤È¤Ë¤è¤Ã¤Æ
+を付けることによって
.I new_root
-¤ÈƱ¤¸¥Ç¥£¥ì¥¯¥È¥ê¤¬ÆÀ¤é¤ì¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+と同じディレクトリが得られなければならない。
.IP \- 3
.\"O No other file system may be mounted on \fIput_old\fP.
-¾¤Î¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤¬
+他のファイルシステムが
.I put_old
-¤Ë¥Þ¥¦¥ó¥È¤µ¤ì¤Æ¤¤¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
+にマウントされていてはならない。
.PP
.\"O See also
.\"O .BR pivot_root (8)
.\"O for additional usage examples.
-ÍøÍÑÎã¤Ë¤Ä¤¤¤Æ¤Ï
+利用例については
.BR pivot_root (8)
-¤ò»²¾È¤Î¤³¤È¡£
+を参照のこと。
.\"O If the current root is not a mount point (e.g., after
.\"O .BR chroot (2)
.\"O .BR pivot_root (),
.\"O see also below), not the old root directory, but the
.\"O mount point of that file system is mounted on \fIput_old\fP.
-¸½ºß¤Î root ¤¬¥Þ¥¦¥ó¥È¥Ý¥¤¥ó¥È¤Ç¤Ï¤Ê¤¤
+現在の root がマウントポイントではない
.RB ( chroot (2)
-¤ä
+や
.BR pivot_root ()
-¤Î¸å¤Ê¤É¡£°Ê²¼¤â»²¾È) ¾ì¹ç¡¢
-¸Å¤¤ root ¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤Ï¤Ê¤¯¡¢
-¤½¤Î¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Î¥Þ¥¦¥ó¥È¥Ý¥¤¥ó¥È¤¬
+の後など。以下も参照) 場合、
+古い root ディレクトリではなく、
+そのファイルシステムのマウントポイントが
.I put_old
-¤Ë¥Þ¥¦¥ó¥È¤µ¤ì¤ë¡£
+にマウントされる。
.\"O \fInew_root\fP does not have to be a mount point.
.\"O In this case,
.\"O \fI/proc/mounts\fP will show the mount point of the file system containing
.\"O \fInew_root\fP as root (\fI/\fP).
.I new_root
-¤Ï¥Þ¥¦¥ó¥È¥Ý¥¤¥ó¥È¤Ç¤Ê¤¯¤Æ¤â¤è¤¤¡£
-¤³¤Î¾ì¹ç
+はマウントポイントでなくてもよい。
+この場合
.I /proc/mounts
-¤Ï¡¢
+は、
.I new_root
-¤ò root
+を root
.RI ( / )
-¤È¤¹¤ë¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Î¥Þ¥¦¥ó¥È¥Ý¥¤¥ó¥È¤òɽ¼¨¤¹¤ë¡£
+とするファイルシステムのマウントポイントを表示する。
.\"O .SH "RETURN VALUE"
-.SH ÊÖ¤êÃÍ
+.SH 返り値
.\"O On success, zero is returned.
.\"O On error, \-1 is returned, and
.\"O \fIerrno\fP is set appropriately.
-À®¸ù¤¹¤ë¤È 0 ¤òÊÖ¤¹¡£¥¨¥é¡¼¤¬µ¯¤ë¤È \-1 ¤òÊÖ¤·¡¢
+成功すると 0 を返す。エラーが起ると \-1 を返し、
.I errno
-¤¬Å¬ÀÚ¤ÊÃͤËÀßÄꤵ¤ì¤ë¡£
+が適切な値に設定される。
.\"O .SH ERRORS
-.SH ¥¨¥é¡¼
+.SH ã\82¨ã\83©ã\83¼
.\"O .BR pivot_root ()
.\"O may return (in \fIerrno\fP) any of the errors returned by
.\"O .BR stat (2).
.\"O Additionally, it may return:
.BR pivot_root ()
-¤Ï
+は
.BR stat (2)
-¤ÎÊÖ¤¹¤¢¤é¤æ¤ë¥¨¥é¡¼¤ò
+の返すあらゆるエラーを
.RI ( errno
-¤Ë) ÊÖ¤¹²ÄǽÀ¤¬¤¢¤ë¡£¤µ¤é¤Ë°Ê²¼¤òÊÖ¤¹¤³¤È¤¬¤¢¤ë:
+に) 返す可能性がある。さらに以下を返すことがある:
.TP
.B EBUSY
.\"O \fInew_root\fP or \fIput_old\fP are on the current root file system,
.\"O or a file system is already mounted on \fIput_old\fP.
-.IR new_root " ¤Þ¤¿¤Ï " put_old
-¤¬¡¢¸½ºß¤Î root ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¾å¤Ë¤¢¤ë¤«¡¢´û¤Ë
+.IR new_root " または " put_old
+が、現在の root ファイルシステム上にあるか、既に
.I put_old
-¤Ë¤Ê¤ó¤é¤«¤Î¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤¬¥Þ¥¦¥ó¥È¤µ¤ì¤Æ¤¤¤ë¡£
+になんらかのファイルシステムがマウントされている。
.TP
.B EINVAL
.\"O \fIput_old\fP is not underneath \fInew_root\fP.
-.IR put_old " ¤¬ " new_root
-¤Î²¼Áؤˤʤ¤¡£
+.IR put_old " が " new_root
+の下層にない。
.TP
.B ENOTDIR
.\"O \fInew_root\fP or \fIput_old\fP is not a directory.
-.IR new_root " ¤Þ¤¿¤Ï " put_old
-¤¬¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤Ê¤¤¡£
+.IR new_root " または " put_old
+がディレクトリでない。
.TP
.B EPERM
.\"O The calling process does not have the
.\"O .B CAP_SYS_ADMIN
.\"O capability.
-¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤¬
+呼び出し元のプロセスが
.B CAP_SYS_ADMIN
-¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡£
+ケーパビリティを持っていない。
.\"O .SH VERSIONS
-.SH ¥Ð¡¼¥¸¥ç¥ó
+.SH バージョン
.\"O .BR pivot_root ()
.\"O was introduced in Linux 2.3.41.
.BR pivot_root ()
-¤Ï Linux 2.3.41 ¤ÇƳÆþ¤µ¤ì¤¿¡£
+は Linux 2.3.41 で導入された。
.\"O .SH "CONFORMING TO"
-.SH ½àµò
+.SH 準拠
.\"O .BR pivot_root ()
.\"O is Linux-specific and hence is not portable.
.BR pivot_root ()
-¤Ï Linux ¤Ë¸ÇͤΤâ¤Î¤Ê¤Î¤Ç¡¢°Ü¿¢À¤Ï¤Ê¤¤¡£
+は Linux に固有のものなので、移植性はない。
.\"O .SH NOTES
-.SH Ãí°Õ
+.SH 注意
.\"O Glibc does not provide a wrapper for this system call; call it using
.\"O .BR syscall (2).
-glibc ¤Ï¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤ËÂФ¹¤ë¥é¥Ã¥Ñ¡¼´Ø¿ô¤òÄ󶡤·¤Æ¤¤¤Ê¤¤¡£
+glibc はこのシステムコールに対するラッパー関数を提供していない。
.BR syscall (2)
-¤ò»È¤Ã¤Æ¸Æ¤Ó½Ð¤¹¤³¤È¡£
+を使って呼び出すこと。
.\"O .SH BUGS
-.SH ¥Ð¥°
+.SH ã\83\90ã\82°
.\"O .BR pivot_root ()
.\"O should not have to change root and current working directory of all other
.\"O processes in the system.
.BR pivot_root ()
-¤Ï¥·¥¹¥Æ¥à¤Î¾¤Î¥×¥í¥»¥¹Á´¤Æ¤Î root ¤È
-¥«¥ì¥ó¥È¥ï¡¼¥¥ó¥°¥Ç¥£¥ì¥¯¥È¥ê¤È¤òÊѹ¹¤·¤Ê¤¯¤Æ¤â¤è¤¤¤Ï¤º¤Ç¤¢¤ë¡£
+はシステムの他のプロセス全ての root と
+カレントワーキングディレクトリとを変更しなくてもよいはずである。
.\"O Some of the more obscure uses of
.\"O .BR pivot_root ()
.\"O may quickly lead to
.\"O insanity.
.BR pivot_root ()
-¤Î»È¤¤Êý¤¬¤â¤¦¤Á¤ç¤Ã¤ÈÛ£Ëæ¤Ë¤Ê¤ë¤È¡¢
-¤¢¤Ã¤È¤¤¤¦´Ö¤Ë¤ï¤±¤Î¤ï¤«¤é¤Ê¤¤¾õÂ֤ˤʤäƤ·¤Þ¤¦¤À¤í¤¦
+の使い方がもうちょっと曖昧になると、
+あっという間にわけのわからない状態になってしまうだろう
.\"O .SH "SEE ALSO"
-.SH ´ØÏ¢¹àÌÜ
+.SH 関連項目
.BR chdir (2),
.BR chroot (2),
.BR stat (2),