OSDN Git Service

Update drafts for LDP 3.67
[linuxjm/LDP_man-pages.git] / draft / man2 / chown.2
index 8d288f8..f99b2f2 100644 (file)
@@ -1,9 +1,8 @@
-.\" Hey Emacs! This file is -*- nroff -*- source.
-.\"
 .\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992
 .\" and Copyright (c) 1998 Andries Brouwer (aeb@cwi.nl)
-.\" and Copyright (c) 2007, 2008 Michael Kerrisk <mtk.manpages@gmail.com>
+.\" and Copyright (c) 2006, 2007, 2008, 2014 Michael Kerrisk <mtk.manpages@gmail.com>
 .\"
+.\" %%%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.
@@ -23,6 +22,7 @@
 .\"
 .\" Formatted or processed versions of this manual, if unaccompanied by
 .\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
 .\"
 .\" Modified by Michael Haardt <michael@moria.de>
 .\" Modified 1993-07-21 by Rik Faith <faith@cs.unc.edu>
 .\"     (bsdgroups versus sysvgroups, and the effect of the parent
 .\"     directory's set-group-ID permission bit).
 .\"
+.\"*******************************************************************
+.\"
+.\" This file was generated with po4a. Translate the source file.
+.\"
+.\"*******************************************************************
+.\"
 .\" Japanese Version Copyright (c) 1996 Yosiaki Yanagihara
 .\"         all rights reserved.
 .\" Translated 1996-06-24, Yosiaki Yanagihara <yosiaki@bsd2.kbnes.nec.co.jp>
 .\" Updated & Modified Wed Dec 29 06:48:16 JST 2004 by Yuichi SATO
 .\" Updated 2007-09-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.64
 .\" Updated 2008-08-09, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.05
+.\" Updated 2012-04-30, Akihiro MOTOKI <amotoki@gmail.com>
 .\"
-.TH CHOWN 2 2010-09-26 "Linux" "Linux Programmer's Manual"
-.\"O .SH NAME
-.SH Ì¾Á°
-.\"O chown, fchown, lchown \- change ownership of a file
-chown, fchown, lchown \- ¥Õ¥¡¥¤¥ë¤Î½êÍ­¼Ô¤òÊѹ¹¤¹¤ë
-.\"O .SH SYNOPSIS
-.SH ½ñ¼°
-.B #include <unistd.h>
+.TH CHOWN 2 2014\-05\-21 Linux "Linux Programmer's Manual"
+.SH 名前
+chown, fchown, lchown, fchownat \- ファイルの所有者を変更する
+.SH 書式
+.nf
+\fB#include <unistd.h>\fP
 .sp
-.BI "int chown(const char *" path ", uid_t " owner ", gid_t " group );
+\fBint chown(const char *\fP\fIpathname\fP\fB, uid_t \fP\fIowner\fP\fB, gid_t \fP\fIgroup\fP\fB);\fP
 .br
-.BI "int fchown(int " fd ", uid_t " owner ", gid_t " group );
+\fBint fchown(int \fP\fIfd\fP\fB, uid_t \fP\fIowner\fP\fB, gid_t \fP\fIgroup\fP\fB);\fP
 .br
-.BI "int lchown(const char *" path ", uid_t " owner ", gid_t " group );
+\fBint lchown(const char *\fP\fIpathname\fP\fB, uid_t \fP\fIowner\fP\fB, gid_t \fP\fIgroup\fP\fB);\fP
+.sp
+\fB#include <fcntl.h>           \fP/* AT_* 定数の定義 */
+\fB#include <unistd.h>\fP
+.sp
+\fBint fchownat(int \fP\fIdirfd\fP\fB, const char *\fP\fIpathname\fP\fB,\fP
+\fB             uid_t \fP\fIowner\fP\fB, gid_t \fP\fIgroup\fP\fB, int \fP\fIflags\fP\fB);\fP
+.fi
+.sp
 .sp
 .in -4n
-.\"O Feature Test Macro Requirements for glibc (see
-.\"O .BR feature_test_macros (7)):
-glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
-.RB ( feature_test_macros (7)
-»²¾È):
+glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
 .in
 .sp
-.BR fchown (),
-.BR lchown ():
+\fBfchown\fP(), \fBlchown\fP():
 .PD 0
 .ad l
 .RS 4
-_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
-_XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
+_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
 .br
-.\"O || /* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200809L
-|| /* glibc 2.12 °Ê¹ß: */ _POSIX_C_SOURCE\ >=\ 200809L
+|| /* glibc 2.12 以降: */ _POSIX_C_SOURCE\ >=\ 200809L
+.RE
+.sp
+\fBfchownat\fP():
+.PD 0
+.ad l
+.RS 4
+.TP  4
+glibc 2.10 以降:
+_XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L
+.TP 
+glibc 2.10 より前:
+_ATFILE_SOURCE
 .RE
 .ad
 .PD
-.\"O .SH DESCRIPTION
-.SH ÀâÌÀ
-.\"O These system calls change the owner and group of a file.
-.\"O The differ only in how the file is specified:
-¤³¤ì¤é¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¡¢¥Õ¥¡¥¤¥ë¤Î½êÍ­¼Ô (owner) ¤È¥°¥ë¡¼¥×¤òÊѹ¹¤¹¤ë¡£
-¥·¥¹¥Æ¥à¥³¡¼¥ë´Ö¤Î°ã¤¤¤Ï¡¢¥Õ¥¡¥¤¥ë¤Î»ØÄê¤Î»ÅÊý¤À¤±¤Ç¤¢¤ë¡£
+.SH 説明
+これらのシステムコールは、いずれもファイルの所有者 (owner) とグループを変更する。システムコール \fBchown\fP(),
+\fBfchown\fP(), \fBlchown\fP() 間の違いは、ファイルの指定の仕方だけである。
 .IP * 2
-.\"O .BR chown ()
-.\"O changes the ownership of the file specified by
-.\"O .IR path ,
-.\"O which is dereferenced if it is a symbolic link.
-.BR chown ()
-¤Ï
-.I path
-¤Ç»ØÄꤵ¤ì¤¿¥Õ¥¡¥¤¥ë¤Î½êÍ­¸¢¤òÊѹ¹¤¹¤ë¡£
-.I path
-¤¬¥·¥ó¥Ü¥ê¥Ã¥¯¡¦¥ê¥ó¥¯¤Î¾ì¹ç¤Ï¡¢¥ê¥ó¥¯¤ÎŸ³«¤¬¹Ô¤ï¤ì¤ë¡£
+\fBchown\fP()  は \fIpathname\fP で指定されたファイルの所有権を変更する。 \fIpathname\fP
+がシンボリックリンクの場合は、リンクの展開が行われる。
 .IP *
-.\"O .BR fchown ()
-.\"O changes the ownership of the file referred to by the open file descriptor
-.\"O .IR fd .
-.BR fchown ()
-¤Ï¥ª¡¼¥×¥ó¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿
-.I fd
-¤Ë¤è¤ê»²¾È¤µ¤ì¤ë¥Õ¥¡¥¤¥ë¤Î½êÍ­¸¢¤òÊѹ¹¤¹¤ë¡£
+\fBfchown\fP()  はオープンされたファイルディスクリプタ \fIfd\fP により参照されるファイルの所有権を変更する。
 .IP *
-.\"O .BR lchown ()
-.\"O is like
-.\"O .BR chown (),
-.\"O but does not dereference symbolic links.
-.BR lchown ()
-¤Ï
-.BR chown ()
-¤ÈƱ¤¸¤À¤¬¡¢¥·¥ó¥Ü¥ê¥Ã¥¯¡¦¥ê¥ó¥¯¤òŸ³«¤·¤Ê¤¤ÅÀ¤¬°Û¤Ê¤ë¡£
+\fBlchown\fP()  は \fBchown\fP()  と同じだが、シンボリックリンクを展開しない点が異なる。
 .PP
-.\"O Only a privileged process (Linux: one with the
-.\"O .B CAP_CHOWN
-.\"O capability) may change the owner of a file.
-Æø¢¤ò»ý¤Ä¥×¥í¥»¥¹ (Linux ¤Ç¤Ï
-.B CAP_CHOWN
-¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£ (capability) ¤ò»ý¤Ä¥×¥í¥»¥¹) ¤À¤±¤¬
-¥Õ¥¡¥¤¥ë¤Î½êÍ­¼Ô¤òÊѹ¹¤Ç¤­¤ë¡£
-.\"O The owner of a file may change the group of the file
-.\"O to any group of which that owner is a member.
-¥Õ¥¡¥¤¥ë¤Î½êÍ­¼Ô¤Ï¡¢¤½¤Î½êÍ­¼Ô¤¬Â°¤·¤Æ¤¤¤ë¥°¥ë¡¼¥×¤Î¤¤¤º¤ì¤«¤Ë
-¥Õ¥¡¥¤¥ë¤Î¥°¥ë¡¼¥×¤òÊѹ¹¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
-.\"O A privileged process (Linux: with
-.\"O .BR CAP_CHOWN )
-.\"O may change the group arbitrarily.
-Æø¢ (Linux ¤Ç¤Ï
-.BR CAP_CHOWN )
-¤ò»ý¤Ä¥×¥í¥»¥¹¤Ï¡¢Ç¤°Õ¤Î¥°¥ë¡¼¥×¤ËÊѹ¹¤Ç¤­¤ë¡£
+特権を持つプロセス (Linux では \fBCAP_CHOWN\fP ケーパビリティ (capability) を持つプロセス) だけが
+ファイルの所有者を変更できる。 ファイルの所有者は、その所有者が属しているグループのいずれかに ファイルのグループを変更することができる。 特権
+(Linux では \fBCAP_CHOWN\fP)  を持つプロセスは、任意のグループに変更できる。
+
+\fIowner\fP または \fIgroup\fP に \-1 が指定された場合、それらの ID は変更されない。
+
+.\" In Linux 2.0 kernels, superuser was like everyone else
+.\" In 2.2, up to 2.2.12, these bits were not cleared for superuser.
+.\" Since 2.2.13, superuser is once more like everyone else.
+非特権ユーザーにより実行ファイルの所有者またはグループが 変更された場合は \fBS_ISUID\fP と \fBISGID\fP モードビットはクリアされる。
+POSIX はこの動作やルートが \fBchown\fP()  を行なった場合については特に指定されていない。 Linux
+における動作はカーネルのバージョンに依存する。 非グループ実行ファイル (\fBS_IXGRP\fP ビットが設定されていないファイル) の場合には
+\fBS_ISGID\fP ビットは強制ロック (mandatory locking) を意味している。 そしてそれは \fBchown\fP()
+ではクリアできない。
+.SS fchownat()
+\fBfchownat\fP() システムコールは \fBchown\fP() と全く同様に動作するが、以下で説明する点が異なる。
+
+\fIpathname\fP で指定されたパス名が相対パスの場合、このパス名はファイルディスクリプター \fIdirfd\fP
+が参照するディレクトリに対する相対パスと解釈される (\fBchown\fP()
+に相対パス名を渡した場合のように、呼び出したプロセスのカレントワーキングディレクトリに対する相対パスではない)。
+
+\fIpathname\fP で指定されたパス名が相対パスで、 \fIdirfd\fP が特別な値 \fBAT_FDCWD\fP の場合、 (\fBchown\fP()
+と同様に) \fIpathname\fP は呼び出したプロセスのカレントワーキングディレクトリに対する相対パスと解釈される。
+
+\fIpathname\fP で指定されたパス名が絶対パスの場合、 \fIdirfd\fP は無視される。
 
-.\"O If the
-.\"O .I owner
-.\"O or
-.\"O .I group
-.\"O is specified as \-1, then that ID is not changed.
-.I owner
-¤Þ¤¿¤Ï
-.I group
-¤Ë \-1 ¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¡¢¤½¤ì¤é¤Î ID ¤ÏÊѹ¹¤µ¤ì¤Ê¤¤¡£
+\fIflags\fP 引き数は、以下に示す値の 0 個以上の OR (論理和) をとって作成される ビットマスクである。
+.TP 
+\fBAT_EMPTY_PATH\fP (Linux 2.6.39 以降)
+.\" commit 65cfc6722361570bfe255698d9cd4dccaf47570d
+.\" Before glibc 2.16, defining _ATFILE_SOURCE sufficed
+\fIpathname\fP が空文字列の場合、 \fIdirfd\fP が参照するファイルに対して操作を行う (\fIdirfd\fP は \fBopen\fP(2)
+\fBO_PATH\fP フラグを使って取得することができる)。この場合、 \fIdirfd\fP
+は、ディレクトリだけでなく、任意のタイプのファイルを参照することができる。 \fIdirfd\fP が \fBAT_FDCWD\fP
+の場合、この呼び出しはカレントワーキングディレクトリに対して操作を行う。このフラグは Linux 固有であり、その定義を得るには
+\fB_GNU_SOURCE\fP を定義すること。
 
-.\"O When the owner or group of an executable file are
-.\"O changed by an unprivileged user the
-.\"O .B S_ISUID
-.\"O and
-.\"O .B S_ISGID
-.\"O mode bits are cleared.
-.\"O POSIX does not specify whether
-.\"O this also should happen when root does the
-.\"O .BR chown ();
-ÈóÆø¢¥æ¡¼¥¶¡¼¤Ë¤è¤ê¼Â¹Ô¥Õ¥¡¥¤¥ë¤Î½êÍ­¼Ô¤Þ¤¿¤Ï¥°¥ë¡¼¥×¤¬
-Êѹ¹¤µ¤ì¤¿¾ì¹ç¤Ï
-.B S_ISUID
-¤È
-.B ISGID
-¥â¡¼¥É¥Ó¥Ã¥È¤Ï¥¯¥ê¥¢¤µ¤ì¤ë¡£
-POSIX ¤Ï¤³¤ÎÆ°ºî¤ä¥ë¡¼¥È¤¬
-.BR chown ()
-¤ò¹Ô¤Ê¤Ã¤¿¾ì¹ç¤Ë¤Ä¤¤¤Æ¤ÏÆä˻ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¡£
-.\"O the Linux behavior depends on the kernel version.
-Linux ¤Ë¤ª¤±¤ëÆ°ºî¤Ï¥«¡¼¥Í¥ë¤Î¥Ð¡¼¥¸¥ç¥ó¤Ë°Í¸¤¹¤ë¡£
-.\"O .\" In Linux 2.0 kernels, superuser was like everyone else
-.\"O .\" In 2.2, up to 2.2.12, these bits were not cleared for superuser.
-.\"O .\" Since 2.2.13, superuser is once more like everyone else.
-.\" Linux 2.0 ¥«¡¼¥Í¥ë¤Ç¤Ï¡¢¥¹¡¼¥Ñ¡¼¡¦¥æ¡¼¥¶¡¼¤Ç¤ÎÆ°ºî¤Ï
-.\" Â¾¤Î¥æ¡¼¥¶¡¼¤Î¾ì¹ç¤ÈƱ¤¸¤Ç¤¢¤Ã¤¿¡£
-.\" 2.2 ¤Ç¤Ï¡¢2.2.12 ¤Þ¤Ç¤Ï¡¢¥¹¡¼¥Ñ¡¼¡¦¥æ¡¼¥¶¡¼¤Î¾ì¹ç¤Ë¤Ï
-.\" ¤³¤ì¤é¤Î¥Ó¥Ã¥È¤Ï¥¯¥ê¥¢¤µ¤ì¤Ê¤¯¤Ê¤Ã¤¿¡£
-.\" 2.2.13 °Ê¹ß¤Ç¤Ï¡¢¥¹¡¼¥Ñ¡¼¡¦¥æ¡¼¥¶¡¼¤Ç¤ÎÆ°ºî¤Ï
-.\" ºÆ¤Ó¾¤Î¥æ¡¼¥¶¡¼¤Î¾ì¹ç¤ÈƱ¤¸¤Ë¤Ê¤Ã¤¿¡£
-.\"O In case of a non-group-executable file (i.e., one for which the
-.\"O .B S_IXGRP
-.\"O bit is not set) the
-.\"O .B S_ISGID
-.\"O bit indicates mandatory locking, and is not cleared by a
-.\"O .BR chown ().
-È󥰥롼¥×¼Â¹Ô¥Õ¥¡¥¤¥ë
-.RB ( S_IXGRP
-¥Ó¥Ã¥È¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¥Õ¥¡¥¤¥ë) ¤Î¾ì¹ç¤Ë¤Ï
-.B S_ISGID
-¥Ó¥Ã¥È¤Ï¶¯À©¥í¥Ã¥¯ (mandatory locking) ¤ò°ÕÌ£¤·¤Æ¤¤¤ë¡£
-¤½¤·¤Æ¤½¤ì¤Ï
-.BR chown ()
-¤Ç¤Ï¥¯¥ê¥¢¤Ç¤­¤Ê¤¤¡£
-.\"O .SH "RETURN VALUE"
-.SH ÊÖ¤êÃÍ
-.\"O On success, zero is returned.
-.\"O On error, \-1 is returned, and
-.\"O .I errno
-.\"O is set appropriately.
-À®¸ù¤¹¤ë¤È¡¢0 ¤òÊÖ¤¹¡£
-¼ºÇÔ¤¹¤ë¤È¡¢\-1 ¤òÊÖ¤·¡¢
-.I errno
-¤ËŬÀÚ¤ÊÃͤòÀßÄꤹ¤ë¡£
-.\"O .SH ERRORS
-.SH ¥¨¥é¡¼
-.\"O Depending on the file system, other errors can be returned.
-.\"O The more general errors for
-.\"O .BR chown ()
-.\"O are listed below.
-¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Ë¤è¤Ã¤Æ¤Ï¾¤Î¥¨¥é¡¼¤¬ÊÖ¤µ¤ì¤ë»ö¤¬¤¢¤ë¡£
-.B chmod
-¤Ç°ìÈÌŪ¤Ê¥¨¥é¡¼¤ò°Ê²¼¤Ëµó¤²¤ë¡£
-.TP
-.B EACCES
-.\"O Search permission is denied on a component of the path prefix.
-.\"O (See also
-.\"O .BR path_resolution (7).)
-.I path
-¤Î¹½À®Í×ÁǤ˸¡º÷µö²Ä (search permission) ¤¬¤Ê¤¤
-.RB ( path_resolution (7)
-¤â»²¾È)¡£
-.TP
-.B EFAULT
-.\"O .I path
-.\"O points outside your accessible address space.
-.I path
-¤¬³ä¤êÅö¤Æ¤é¤ì¤¿¥¢¥É¥ì¥¹¶õ´Ö³°¤ò»Ø¤·¤Æ¤¤¤ë¡£
-.TP
-.B ELOOP
-.\"O Too many symbolic links were encountered in resolving
-.\"O .IR path .
-.I path
-¤ò²ò·è¤¹¤ëºÝ¤ËÁø¶ø¤·¤¿¥·¥ó¥Ü¥ê¥Ã¥¯¡¦¥ê¥ó¥¯¤¬Â¿²á¤®¤ë¡£
-.TP
-.B ENAMETOOLONG
-.\"O .I path
-.\"O is too long.
-.I path
-¤¬Ä¹²á¤®¤ë¡£
-.TP
-.B ENOENT
-.\"O The file does not exist.
-¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Ê¤¤¡£
-.TP
-.B ENOMEM
-.\"O Insufficient kernel memory was available.
-¥«¡¼¥Í¥ë¤Ë½½Ê¬¤Ê¥á¥â¥ê¤¬¤Ê¤¤¡£
-.TP
-.B ENOTDIR
-.\"O A component of the path prefix is not a directory.
-.I path
-¤Î¹½À®Í×ÁǤ¬¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤Ê¤¤¡£
-.TP
-.B EPERM
-.\"O The calling process did not have the required permissions
-.\"O (see above) to change owner and/or group.
-¸Æ¤Ó½Ð¤·¤¿¥×¥í¥»¥¹¤Ë½êÍ­¼Ô¤Þ¤¿¤Ï¥°¥ë¡¼¥× (¤â¤·¤¯¤Ï¤½¤ÎξÊý) ¤òÊѹ¹¤¹¤ë¤¿¤á¤Ë
-Í׵ᤵ¤ì¤ëµö²Ä (¾åµ­¤ò»²¾È) ¤¬¤Ê¤¤¡£
-.TP
-.B EROFS
-.\"O The named file resides on a read-only file system.
-»ØÄꤷ¤¿¥Õ¥¡¥¤¥ë¤¬Æɤ߹þ¤ßÀìÍÑ (read-only) ¤Î¥Õ¥¡¥¤¥ë¡¦¥·¥¹¥Æ¥à¾å¤Ë¤¢¤ë¡£
+.TP 
+\fBAT_SYMLINK_NOFOLLOW\fP
+\fIpathname\fP がシンボリックリンクの場合、リンクの展開を行わない。代わりに、\fBlchown\fP()
+同様、リンク自身に対して操作を行う。(デフォルトでは \fBfchownat\fP() は \fBchown\fP() と同様にシンボリックリンクの展開を行う。)
 .PP
-.\"O The general errors for
-.\"O .BR fchown ()
-.\"O are listed below:
-.BR fchown ()
-¤Ç°ìÈÌŪ¤Ê¥¨¥é¡¼¤ò°Ê²¼¤Ëµó¤²¤ë:
-.TP
-.B EBADF
-.\"O The descriptor is not valid.
-¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼¤¬Í­¸ú¤Ç¤Ê¤¤¡£
-.TP
-.B EIO
-.\"O A low-level I/O error occurred while modifying the inode.
-i ¥Î¡¼¥É (inode) ¤òÊѹ¹¤¹¤ëºÝ¤ËÄã¥ì¥Ù¥ë I/O ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
-.TP
-.B ENOENT
-.\"O See above.
-¾åµ­¤ò»²¾È¡£
-.TP
-.B EPERM
-.\"O See above.
-¾åµ­¤ò»²¾È¡£
-.TP
-.B EROFS
-.\"O See above.
-¾åµ­¤ò»²¾È¡£
-.\"O .SH "CONFORMING TO"
-.SH ½àµò
-4.4BSD, SVr4, POSIX.1-2001.
+\fBfchownat\fP() の必要性についての説明については \fBopenat\fP(2) を参照。
+.SH 返り値
+成功した場合は 0 が返される。エラーの場合は \-1 が返され、 \fIerrno\fP が適切に設定される。
+.SH エラー
+ファイルシステムによっては、下記の一覧にない他のエラーが返されることもある。
+
+\fBchown\fP()  でごく一般的なエラーを以下に挙げる:
+.TP 
+\fBEACCES\fP
+パス名の構成要素に検索許可がない (\fBpath_resolution\fP(7)  も見よ)。
+.TP 
+\fBEFAULT\fP
+\fIpathname\fP がアクセス可能なアドレス空間の外を指している。
+.TP 
+\fBELOOP\fP
+\fIpathname\fP を解決するときに、解決すべきシンボリックリンクが多すぎた。
+.TP 
+\fBENAMETOOLONG\fP
+\fIpathname\fP が長過ぎる。
+.TP 
+\fBENOENT\fP
+ファイルが存在しない。
+.TP 
+\fBENOMEM\fP
+カーネルに十分なメモリがない。
+.TP 
+\fBENOTDIR\fP
+パス名の構成要素がディレクトリではない。
+.TP 
+\fBEPERM\fP
+呼び出したプロセスに所有者またはグループ (もしくはその両方) を変更するために 要求される許可 (上記を参照) がない。
+.TP 
+\fBEROFS\fP
+ファイルが読み込み専用 (read only) のファイルシステム上にある。
+.PP
+\fBfchown\fP()  で一般的なエラーを以下に挙げる:
+.TP 
+\fBEBADF\fP
+ディスクリプターが有効でない。
+.TP 
+\fBEIO\fP
+i ノード (inode) を変更する際に低レベル I/O エラーが発生した。
+.TP 
+\fBENOENT\fP
+上記を参照。
+.TP 
+\fBEPERM\fP
+上記を参照。
+.TP 
+\fBEROFS\fP
+上記を参照。
+.PP
+\fBchown\fP() で発生するのと同じエラーが \fBfchownat\fP() でも起こる。 \fBfchownat\fP() では以下のエラーも発生する。
+.TP 
+\fBEBADF\fP
+\fIdirfd\fP が適切なファイルディスクリプタでない。
+.TP 
+\fBEINVAL\fP
+\fIflags\fP に無効なフラグが指定された。
+.TP 
+\fBENOTDIR\fP
+\fIpathname\fP が相対パスで、 \fIdirfd\fP がディレクトリ以外のファイルを参照しているファイルディスクリプタである。
+.SH バージョン
+\fBfchownat\fP()  はカーネル 2.6.16 で Linux に追加された。 ライブラリによるサポートはバージョン 2.4 以降の glibc
+で利用できる。
+.SH 準拠
+\fBchown\fP(), \fBfchown\fP(), \fBlchown\fP(): 4.4BSD, SVr4, POSIX.1\-2001,
+POSIX.1\-2008.
 
-.\"O The 4.4BSD version can only be
-.\"O used by the superuser (that is, ordinary users cannot give away files).
-4.4BSD ÈǤǤϥ¹¡¼¥Ñ¡¼¡¦¥æ¡¼¥¶¡¼¤Î¤ß¤¬»ÈÍѤǤ­¤ë
-(¤Ä¤Þ¤ê¡¢ÉáÄ̤Υ桼¥¶¡¼¤Ï¥Õ¥¡¥¤¥ë¤ò¼êÊü¤¹¤³¤È¤Ï¤Ç¤­¤Ê¤¤)¡£
-.\"O .\" chown():
-.\"O .\" SVr4 documents EINVAL, EINTR, ENOLINK and EMULTIHOP returns, but no
-.\"O .\" ENOMEM.  POSIX.1 does not document ENOMEM or ELOOP error conditions.
 .\" chown():
-.\" SVr4 ¤Ë¤Ï EINVAL, EINTR, ENOLINK, EMULTIHOP ¤òÊÖ¤¹¤Èµ­ºÜ¤µ¤ì¤Æ¤¤¤ë¤¬¡¢
-.\" ENOMEM ¤Ï¤Ê¤¤¡£
-.\" POSIX.1 ¤Ë¤Ï ENOMEM, ELOOP ¤Ë¤Ä¤¤¤Æµ­ºÜ¤Ï¤Ê¤¤¡£
-.\"O .\" fchown():
-.\"O .\" SVr4 documents additional EINVAL, EIO, EINTR, and ENOLINK
-.\"O .\" error conditions.
+.\" SVr4 documents EINVAL, EINTR, ENOLINK and EMULTIHOP returns, but no
+.\" ENOMEM.  POSIX.1 does not document ENOMEM or ELOOP error conditions.
 .\" fchown():
-.\" SVr4 ¤Ë¤Ï¾¤Ë EINVAL, EIO, EINTR, ENOLINK ¥¨¥é¡¼¾õÂ֤ˤĤ¤¤Æ¤Îµ­ºÜ¤¬¤¢¤ë¡£
-.\"O .SH NOTES
-.SH Ãí°Õ
-.\"O When a new file is created (by, for example,
-.\"O .BR open (2)
-.\"O or
-.\"O .BR mkdir (2)),
-.\"O its owner is made the same as the file system user ID of the
-.\"O creating process.
-.RB ( open (2)
-¤ä
-.BR mkdir (2)
-¤Ê¤É¤Ë¤è¤ê) ¿·¤·¤¤¥Õ¥¡¥¤¥ë¤¬ºîÀ®¤µ¤ì¤ë¤È¤­¡¢
-¤½¤Î½êÍ­¼Ô¤Ï¸Æ¤Ó½Ð¤·¤¿¥×¥í¥»¥¹¤Î¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¡¦¥æ¡¼¥¶ ID ¤È
-Ʊ¤¸¤ËÀßÄꤵ¤ì¤ë¡£
-.\"O The group of the file depends on a range of factors,
-.\"O including the type of file system,
-.\"O the options used to mount the file system,
-.\"O and whether or not the set-group-ID permission bit is enabled
-.\"O on the parent directory.
-¤½¤Î¥Õ¥¡¥¤¥ë¤Î¥°¥ë¡¼¥×¤Ï¤¤¤¯¤Ä¤«¤ÎÍ×°ø¤Ë¤è¤ê·èÄꤵ¤ì¤ë¡£
-¤½¤ÎÍ×°ø¤È¤·¤Æ¤Ï¡¢
-¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Î¼ïÎà¡¢¤½¤Î¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Î¥Þ¥¦¥ó¥È»þ¤Ë
-»ÈÍѤµ¤ì¤¿¥ª¥×¥·¥ç¥ó¡¢¿Æ¥Ç¥£¥ì¥¯¥È¥ê¤Ç set-group-ID µö²Ä¥Ó¥Ã¥È¤¬
-Í­¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤É¤¦¤«¡¢¤¬¤¢¤ë¡£
-.\"O If the file system supports the
-.\"O .I "\-o\ grpid"
-.\"O (or, synonymously
-.\"O .IR "\-o\ bsdgroups" )
-.\"O and
-.\"O .I "\-o\ nogrpid"
-.\"O (or, synonymously
-.\"O .IR "\-o\ sysvgroups" )
-.\"O .BR mount (8)
-.\"O options, then the rules are as follows:
-¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤¬
-.BR mount (8)
-¥ª¥×¥·¥ç¥ó¤Î
-.I "\-o\ grpid"
-.RI ( "\-o\ bsdgroups"
-¤âƱµÁ¸ì) ¤È
-.I "\-o\ nogrpid"
-.RI ( "\-o sysvgroups"
-¤âƱµÁ¸ì) ¤ËÂбþ¤·¤Æ¤¤¤ë¾ì¹ç¡¢¥ë¡¼¥ë¤Ï°Ê²¼¤ÎÄ̤ê¤È¤Ê¤ë¡£
+.\" SVr4 documents additional EINVAL, EIO, EINTR, and ENOLINK
+.\" error conditions.
+4.4BSD 版ではスーパーユーザーのみが使用できる (つまり、普通のユーザーはファイルを手放すことはできない)。
+
+\fBfchownat\fP(): POSIX.1\-2008.
+.SH 注意
+.SS 新しいファイルの所有権
+(\fBopen\fP(2)  や \fBmkdir\fP(2)  などにより) 新しいファイルが作成されるとき、
+その所有者は呼び出したプロセスのファイルシステムユーザ ID と 同じに設定される。 そのファイルのグループはいくつかの要因により決定される。
+その要因としては、 ファイルシステムの種類、そのファイルシステムのマウント時に 使用されたオプション、親ディレクトリで set\-group\-ID
+許可ビットが 有効になっているどうか、がある。 ファイルシステムが \fBmount\fP(8)  オプションの \fI\-o\ grpid\fP (\fI\-o\ bsdgroups\fP も同義語) と \fI\-o\ nogrpid\fP (\fI\-o sysvgroups\fP も同義語)
+に対応している場合、ルールは以下の通りとなる。
 .IP * 2
-.\"O If the file system is mounted with
-.\"O .IR "\-o\ grpid" ,
-.\"O then the group of a new file is made
-.\"O the same as that of the parent directory.
-¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤¬
-.I "\-o\ grpid"
-ÉÕ¤­¤Ç¥Þ¥¦¥ó¥È¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢¿·¤·¤¤¥Õ¥¡¥¤¥ë¤Î¥°¥ë¡¼¥×¤Ï
-¿Æ¥Ç¥£¥ì¥¯¥È¥ê¤Î¥°¥ë¡¼¥×¤ÈƱ¤¸¤Ë¤Ê¤ë¡£
+ファイルシステムが \fI\-o\ grpid\fP 付きでマウントされている場合、新しいファイルのグループは 親ディレクトリのグループと同じになる。
 .IP *
-.\"O If the file system is mounted with
-.\"O .IR "\-o\ nogrpid"
-.\"O and the set-group-ID bit is disabled on the parent directory,
-.\"O then the group of a new file is made the same as the
-.\"O process's file system GID.
-¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤¬
-.I "\-o\ nogrpid"
-ÉÕ¤­¤Ç¥Þ¥¦¥ó¥È¤µ¤ì¤Æ¤ª¤ê¡¢¿Æ¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤Ï set-group-ID ¥Ó¥Ã¥È¤¬
-̵¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤ë¾ì¹ç¡¢¿·¤·¤¤¥Õ¥¡¥¤¥ë¤Î¥°¥ë¡¼¥×¤Ï
-¥×¥í¥»¥¹¤Î¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à GID ¤ÈƱ¤¸¤Ë¤Ê¤ë¡£
+ファイルシステムが \fI\-o\ nogrpid\fP 付きでマウントされており、親ディレクトリでは set\-group\-ID ビットが
+無効になっている場合、新しいファイルのグループは プロセスのファイルシステム GID と同じになる。
 .IP *
-.\"O If the file system is mounted with
-.\"O .IR "\-o\ nogrpid"
-.\"O and the set-group-ID bit is enabled on the parent directory,
-.\"O then the group of a new file is made
-.\"O the same as that of the parent directory.
-¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤¬
-.I "\-o\ nogrpid"
-ÉÕ¤­¤Ç¥Þ¥¦¥ó¥È¤µ¤ì¤Æ¤ª¤ê¡¢¿Æ¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤Ï set-group-ID ¥Ó¥Ã¥È¤¬
-Í­¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤ë¾ì¹ç¡¢¿·¤·¤¤¥Õ¥¡¥¤¥ë¤Î¥°¥ë¡¼¥×¤Ï
-¿Æ¥Ç¥£¥ì¥¯¥È¥ê¤Î¥°¥ë¡¼¥×¤ÈƱ¤¸¤Ë¤Ê¤ë¡£
-.PP
-.\"O As at Linux 2.6.25,
-.\"O the
-.\"O .IR "\-o\ grpid"
-.\"O and
-.\"O .IR "\-o\ nogrpid"
-.\"O mount options are supported by ext2, ext3, ext4, and XFS.
-.\"O File systems that don't support these mount options follow the
-.\"O .IR "\-o\ nogrpid"
-.\"O rules.
-Linux 2.6.25 ¤Ç¤Ï¡¢¥Þ¥¦¥ó¥È¥ª¥×¥·¥ç¥ó
-.I "\-o\ grpid"
-¤È
-.I "\-o\ nogrpid"
-¤ËÂбþ¤·¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Ï
-ext2, ext3, ext4, XFS ¤Ç¤¢¤ë¡£
-¤³¤ì¤é¤Î¥Þ¥¦¥ó¥È¥ª¥×¥·¥ç¥ó¤ËÂбþ¤·¤Æ¤¤¤Ê¤¤¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Ç¤Ï¡¢
-.I "\-o\ nogrpid"
-¤Ë´Ø¤¹¤ë¥ë¡¼¥ë¤¬Å¬ÍѤµ¤ì¤ë¡£
+ファイルシステムが \fI\-o\ nogrpid\fP 付きでマウントされており、親ディレクトリでは set\-group\-ID ビットが
+有効になっている場合、新しいファイルのグループは 親ディレクトリのグループと同じになる。
 .PP
-.\"O The
-.\"O .BR chown ()
-.\"O semantics are deliberately violated on NFS file systems
-.\"O which have UID mapping enabled.
-.\"O Additionally, the semantics of all system
-.\"O calls which access the file contents are violated, because
-.\"O .BR chown ()
-.\"O may cause immediate access revocation on already open files.
-.\"O Client side
-.\"O caching may lead to a delay between the time where ownership have
-.\"O been changed to allow access for a user and the time where the file can
-.\"O actually be accessed by the user on other clients.
-.BR chown ()
-Êý¼°¤Ï UID ¥Þ¥Ã¥Ô¥ó¥°¤ò»ÈÍѤ·¤¿
-NFS ¥Õ¥¡¥¤¥ë¡¦¥·¥¹¥Æ¥à¤ò¿¯³²¤¹¤ë¡£
-¤µ¤é¤Ë¥Õ¥¡¥¤¥ë¤ÎÆâÍƤ˥¢¥¯¥»¥¹¤¹¤ëÁ´¤Æ¤Î¥·¥¹¥Æ¥à¡¦¥³¡¼¥ë¤ò¿¯³²¤¹¤ë¡£
-¤³¤ì¤Ï
-.BR chown ()
-¤¬´û¤Ë¥ª¡¼¥×¥ó¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤ËÂФ¹¤ë
-¥¢¥¯¥»¥¹¤ò¤¿¤À¤Á¤Ë¼è¤ê¾Ã¤¹¤³¤È¤Ë¤è¤ë¡£
-¥¯¥é¥¤¥¢¥ó¥È¦¤Î¥­¥ã¥Ã¥·¥å¤Ë¤è¤ê½êÍ­¸¢¤¬Êѹ¹¤µ¤ì¤Æ
-¥æ¡¼¥¶¡¼¤Î¥¢¥¯¥»¥¹¤¬µö¤·¤¿»þÅÀ¤È¡¢¼ÂºÝ¤Ë¾¤Î¥¯¥é¥¤¥¢¥ó¥È¤Ç¥æ¡¼¥¶¡¼¤Ë¤è¤Ã¤Æ
-¥Õ¥¡¥¤¥ë¤Ë¥¢¥¯¥»¥¹¤Ç¤­¤ë»þÅÀ¤È¤Î´Ö¤Ë»þ´Öº¹¤¬¤¢¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
+Linux 2.6.25 では、マウントオプション \fI\-o\ grpid\fP と \fI\-o\ nogrpid\fP に対応しているファイルシステムは
+ext2, ext3, ext4, XFS である。 これらのマウントオプションに対応していないファイルシステムでは、 \fI\-o\ nogrpid\fP
+に関するルールが適用される。
+.SS NFS
+\fBchown\fP()  方式は UID マッピングを使用した NFS ファイルシステムを侵害する。
+さらにファイルの内容にアクセスする全てのシステムコールを侵害する。 これは \fBchown\fP()  が既にオープンされたファイルに対する
+アクセスをただちに取り消すことによる。 クライアント側のキャッシュにより所有権が変更されて
+ユーザーのアクセスが許した時点と、実際に他のクライアントでユーザーによって ファイルにアクセスできる時点との間に時間差があるかもしれない。
+.SS 歴史的な詳細
+元々の Linux の \fBchown\fP(), \fBfchown\fP(), \fBlchown\fP() システムコールは、
+16 ビットのユーザ ID とグループ ID だけに対応していた。
+その後、 32 ビットの ID に対応した \fBchown32\fP(), \fBfchown32\fP(), \fBlchown32\fP()
+が Linux 2.4 で追加された。
+\fBchown\fP(), \fBfchown\fP(), and \fBlchown\fP() の glibc のラッパー関数は、
+カーネルのバージョンによる違いを吸収している。
 
-.\"O In versions of Linux prior to 2.1.81 (and distinct from 2.1.46),
-.\"O .BR chown ()
-.\"O did not follow symbolic links.
-Linux ¤Î 2.1.81 ¤è¤êÁ°¤Î¥Ð¡¼¥¸¥ç¥ó (Æäˠ2.1.46 °ÊÁ°) ¤Ç¤Ï¡¢
-.BR chown ()
-¤Ï¥·¥ó¥Ü¥ê¥Ã¥¯¡¦¥ê¥ó¥¯¤òÄÉÀפ·¤Ê¤¤¡£
-.\"O Since Linux 2.1.81,
-.\"O .BR chown ()
-.\"O does follow symbolic links, and there is a new system call
-.\"O .BR lchown ()
-.\"O that does not follow symbolic links.
-Linux 2.1.81 °Ê¹ß¤Ç¤Ï
-.BR chown ()
-¤Ï¥·¥ó¥Ü¥ê¥Ã¥¯¡¦¥ê¥ó¥¯¤òÄÉÀפ·¡¢¿·¤¿¤Ê¥·¥¹¥Æ¥à¡¦¥³¡¼¥ë
-.BR lchown ()
-¤Ï¥·¥ó¥Ü¥ê¥Ã¥¯¡¦¥ê¥ó¥¯¤òÄÉÀפ·¤Ê¤¤¡£
-.\"O Since Linux 2.1.86, this new call (that has the same semantics
-.\"O as the old
-.\"O .BR chown ())
-.\"O has got the same syscall number, and
-.\"O .BR chown ()
-.\"O got the newly introduced number.
-Linux 2.1.86 °Ê¹ß¤Ç¤Ï¤³¤Î¿·¤·¤¤¥³¡¼¥ë (¸Å¤¤
-.BR chown ()
-¤ÈÁ´¤¯Æ±¤¸Æ°ºî¤ò¹Ô¤Ê¤¦) ¤ÏƱ¤¸¥·¥¹¥Æ¥à¥³¡¼¥ëÈÖ¹æ¤ò»ý¤Á
-.BR chown ()
-¤Ï¿·¤·¤¯Æ³Æþ¤µ¤ì¤¿ÈÖ¹æ¤ò»ý¤Ä¡£
-.\"O .SH EXAMPLE
-.SH Îã
+Linux の 2.1.81 より前のバージョン (特に 2.1.46 以前) では、 \fBchown\fP()  はシンボリックリンクを追跡しない。
+Linux 2.1.81 以降では \fBchown\fP()  はシンボリックリンクを追跡し、新たなシステムコール \fBlchown\fP()
+はシンボリックリンクを追跡しない。 Linux 2.1.86 以降ではこの新しいコール (古い \fBchown\fP()  と全く同じ動作を行なう)
+は同じシステムコール番号を持ち \fBchown\fP()  は新しく導入された番号を持つ。
+.SH 例
 .PP
-.\"O The following program changes the ownership of the file named in
-.\"O its second command-line argument to the value specified in its
-.\"O first command-line argument.
-.\"O The new owner can be specified either as a numeric user ID,
-.\"O or as a username (which is converted to a user ID by using
-.\"O .BR getpwnam (3)
-.\"O to perform a lookup in the system password file).
-°Ê²¼¤Î¥×¥í¥°¥é¥à¤Ï¡¢
-Æó¤ÄÌܤΥ³¥Þ¥ó¥É¥é¥¤¥ó°ú¤­¿ô¤Ç»ØÄꤵ¤ì¤¿Ì¾Á°¤Î¥Õ¥¡¥¤¥ë¤Î½êÍ­¼Ô¤ò¡¢
-°ì¤ÄÌܤΥ³¥Þ¥ó¥É¥é¥¤¥ó°ú¤­¿ô¤Ç»ØÄꤵ¤ì¤¿ÃͤËÊѹ¹¤¹¤ë¡£
-¿·¤·¤¤½êÍ­¼Ô¤Ï¡¢¿ô»ú¤Î¥æ¡¼¥¶ ID ¤«¥æ¡¼¥¶Ì¾¤Î¤¤¤º¤ì¤«¤Ç»ØÄê¤Ç¤­¤ë
-(¥æ¡¼¥¶Ì¾¤Ç»ØÄꤷ¤¿¾ì¹ç¤Ë¤Ï¡¢
-.BR getpwnam (3)
-¤ò»È¤Ã¤Æ¥·¥¹¥Æ¥à¤Î¥Ñ¥¹¥ï¡¼¥É¥Õ¥¡¥¤¥ë¤Î¸¡º÷¤¬¹Ô¤ï¤ì¡¢
-¥æ¡¼¥¶ ID ¤Ø¤ÎÊÑ´¹¤¬¹Ô¤ï¤ì¤ë)¡£
+以下のプログラムは、 二つ目のコマンドライン引き数で指定された名前のファイルの所有者を、 一つ目のコマンドライン引き数で指定された値に変更する。
+新しい所有者は、数字のユーザ ID かユーザ名のいずれかで指定できる (ユーザ名で指定した場合には、 \fBgetpwnam\fP(3)
+を使ってシステムのパスワードファイルの検索が行われ、 ユーザ ID への変換が行われる)。
+.SS プログラムのソース
 .nf
-
 #include <pwd.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -478,14 +284,14 @@ main(int argc, char *argv[])
     struct passwd *pwd;
     char *endptr;
 
-    if (argc != 3 || argv[1][0] == \(aq\\0\(aq) {
-        fprintf(stderr, "%s <owner> <file>\\n", argv[0]);
+    if (argc != 3 || argv[1][0] == \(aq\e0\(aq) {
+        fprintf(stderr, "%s <owner> <file>\en", argv[0]);
         exit(EXIT_FAILURE);
     }
 
     uid = strtol(argv[1], &endptr, 10);  /* Allow a numeric string */
 
-    if (*endptr != \(aq\\0\(aq) {         /* Was not pure numeric string */
+    if (*endptr != \(aq\e0\(aq) {         /* Was not pure numeric string */
         pwd = getpwnam(argv[1]);   /* Try getting UID for username */
         if (pwd == NULL) {
             perror("getpwnam");
@@ -503,10 +309,9 @@ main(int argc, char *argv[])
     exit(EXIT_SUCCESS);
 }
 .fi
-.\"O .SH "SEE ALSO"
-.SH ´ØÏ¢¹àÌÜ
-.BR chmod (2),
-.BR fchownat (2),
-.BR flock (2),
-.BR path_resolution (7),
-.BR symlink (7)
+.SH 関連項目
+\fBchmod\fP(2), \fBflock\fP(2), \fBpath_resolution\fP(7), \fBsymlink\fP(7)
+.SH この文書について
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.67 の一部
+である。プロジェクトの説明とバグ報告に関する情報は
+http://www.kernel.org/doc/man\-pages/ に書かれている。