OSDN Git Service

74389110819d40411bac83fd53eb42cf24c2c2c6
[linuxjm/LDP_man-pages.git] / release / man2 / fchownat.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" This manpage is Copyright (C) 2006, Michael Kerrisk
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
25 .\" Japanese Version Copyright (c) 2006 Yuichi SATO
26 .\"         all rights reserved.
27 .\" Translated 2006-10-14 by Yuichi SATO <ysato444@yahoo.co.jp>, LDP v2.39
28 .\"
29 .TH FCHOWNAT 2 2009-12-13 "Linux" "Linux Programmer's Manual"
30 .SH 名前
31 fchownat \- ディレクトリファイルディスクリプタから相対的な位置にあるファイルの所有者を変更する
32 .SH 書式
33 .nf
34 .B #include <fcntl.h>           /* AT_* 定数の定義 */
35 .B #include <unistd.h>
36 .sp
37 .BI "int fchownat(int " dirfd ", const char *" pathname ,
38 .BI "             uid_t " owner ", gid_t " group ", int " flags );
39 .fi
40 .sp
41 .in -4n
42 glibc 向けの機能検査マクロの要件
43 .RB ( feature_test_macros (7)
44 参照):
45 .in
46 .sp
47 .BR fchownat ():
48 .PD 0
49 .ad l
50 .RS 4
51 .TP 4
52 glibc 2.10 以降:
53 _XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L
54 .RE
55 .ad
56 .PD
57 .TP
58 glibc 2.10 より前:
59 _ATFILE_SOURCE
60 .SH 説明
61 .BR fchownat ()
62 システムコールは、この man ページで説明している違いがある以外は、
63 .BR chown (2)
64 と全く同じように動作する。
65
66 .I pathname
67 で指定されるパス名が相対パスである場合、
68 ファイルディスクリプタ
69 .I dirfd
70 で参照されるディレクトリからの相対パス名として解釈される
71 .RB ( chown (2)
72 では、相対パスは呼び出し元プロセスのカレントワーキングディレクトリからの
73 相対パスとなる)。
74
75 .I pathname
76 が相対パスであり、かつ
77 .I dirfd
78 が特別な値
79 .B AT_FDCWD
80 である場合、
81 .I pathname
82
83 .RB ( chown (2)
84 と同じように) 呼び出し元プロセスの
85 カレントワーキングディレクトリからの相対パス名として解釈される。
86
87 .I pathname
88 が絶対パスである場合、
89 .I dirfd
90 は無視される。
91
92 .I flags
93 は 0 または以下のフラグである。
94 .TP
95 .B AT_SYMLINK_NOFOLLOW
96 .I pathname
97 がシンボリックリンクの場合は、それを辿るのではなく、
98 .BR lchown (2)
99 と同様にリンク自身に対して (所有者の変更の) 操作を行う
100 (デフォルトでは、
101 .BR fchownat ()
102
103 .BR chown (2)
104 と同様にシンボリックリンクを辿る)。
105 .SH 返り値
106 成功した場合、
107 .BR fchownat ()
108 は 0 を返す。
109 エラーの場合、\-1 が返されて、
110 .I errno
111 にはエラーを示す値が設定される。
112 .SH エラー
113 .BR chown (2)
114 と同じエラーが
115 .BR fchownat ()
116 でも起こる。
117 .BR fchownat ()
118 では、その他に以下のエラーが起こる:
119 .TP
120 .B EBADF
121 .I dirfd
122 が有効なファイルディスクリプタでない。
123 .TP
124 .B EINVAL
125 .I flags
126 に不正なフラグ値が指定された。
127 .TP
128 .B ENOTDIR
129 .I pathname
130 が相対パスで、かつ
131 .I dirfd
132 がディレクトリ以外のファイルを参照するファイルディスクリプタである。
133 .SH バージョン
134 .BR fchownat ()
135 は Linux カーネル 2.6.16 で追加された。
136 .SH 準拠
137 POSIX.1-2008.
138 Solaris には、これと同じようなシステムコールが存在する。
139 .SH 注意
140 .BR fchownat ()
141 が必要な理由については、
142 .BR openat (2)
143 を参照すること。
144 .SH 関連項目
145 .BR chown (2),
146 .BR openat (2),
147 .BR path_resolution (7),
148 .BR symlink (7)