OSDN Git Service

(split) LDP v3.30, v3.31 の定型的な変更内容を反映。
[linuxjm/LDP_man-pages.git] / draft / man2 / setxattr.2
1 .\"
2 .\" Extended attributes system calls manual pages
3 .\"
4 .\" Copyright (C) Andreas Gruenbacher, February 2001
5 .\" Copyright (C) Silicon Graphics Inc, September 2001
6 .\"
7 .\" This is free documentation; you can redistribute it and/or
8 .\" modify it under the terms of the GNU General Public License as
9 .\" published by the Free Software Foundation; either version 2 of
10 .\" the License, or (at your option) any later version.
11 .\"
12 .\" The GNU General Public License's references to "object code"
13 .\" and "executables" are to be interpreted as the output of any
14 .\" document formatting or typesetting system, including
15 .\" intermediate and printed output.
16 .\"
17 .\" This manual is distributed in the hope that it will be useful,
18 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
19 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 .\" GNU General Public License for more details.
21 .\"
22 .\" You should have received a copy of the GNU General Public
23 .\" License along with this manual; if not, write to the Free
24 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
25 .\" USA.
26 .\"
27 .\" Japanese Version Copyright (c) 2003  Akihiro MOTOKI
28 .\"         all rights reserved.
29 .\" Translated Tue Jul  8 04:43:40 JST 2003
30 .\"         by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
31 .\"
32 .\"WORD:        extended attributes     ³Èĥ°À­
33 .\"WORD:        namespace               Ì¾Á°¶õ´Ö
34 .\"
35 .TH SETXATTR 2 2001-12-31 "Linux" "Linux Programmer's Manual"
36 .\"O .SH NAME
37 .\"O setxattr, lsetxattr, fsetxattr \- set an extended attribute value
38 .SH Ì¾Á°
39 setxattr, lsetxattr, fsetxattr \- ³Èĥ°À­¤ÎÃͤòÀßÄꤹ¤ë
40 .\"O .SH SYNOPSIS
41 .SH ½ñ¼°
42 .fam C
43 .nf
44 .B #include <sys/types.h>
45 .B #include <attr/xattr.h>
46 .sp
47 .BI "int setxattr(const char\ *" path ", const char\ *" name ,
48 .BI "              const void\ *" value ", size_t " size ", int " flags );
49 .BI "int lsetxattr(const char\ *" path ", const char\ *" name ,
50 .BI "              const void\ *" value ", size_t " size ", int " flags );
51 .BI "int fsetxattr(int " fd ", const char\ *" name ,
52 .BI "              const void\ *" value ", size_t " size ", int " flags );
53 .fi
54 .fam T
55 .\"O .SH DESCRIPTION
56 .SH ÀâÌÀ
57 .\"O Extended attributes are
58 .\"O .IR name :\c
59 .\"O .I value
60 .\"O pairs associated with inodes (files, directories, symbolic links, etc.).
61 .\"O They are extensions to the normal attributes which are associated
62 .\"O with all inodes in the system (i.e., the
63 .\"O .BR stat (2)
64 .\"O data).
65 .\"O A complete overview of extended attributes concepts can be found in
66 .\"O .BR attr (5).
67 ³Èĥ°À­¤Ï¡¢inode (¥Õ¥¡¥¤¥ë¡¢¥Ç¥£¥ì¥¯¥È¥ê¡¢¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯Åù) ¤Ë
68 ´ØÏ¢ÉÕ¤±¤é¤ì¤¿
69 .IR name :\c
70 .I value
71 ¤ÎÂФǤ¢¤ë¡£
72 ¤³¤ì¤é¤Ï¡¢¥·¥¹¥Æ¥à¾å¤Î¤¹¤Ù¤Æ¤Î inode ¤Ë´ØÏ¢ÉÕ¤±¤é¤ì¤¿Ä̾ï¤Î°À­
73 .RB ( stat (2)
74 ¤¬ÊÖ¤¹¥Ç¡¼¥¿) ¤ò³ÈÄ¥¤¹¤ë¤â¤Î¤Ç¤¢¤ë¡£
75 ³Èĥ°À­¤Î¥³¥ó¥»¥×¥È¤Ï
76 .BR attr (5)
77 ¤Ë½ñ¤«¤ì¤Æ¤¤¤ë¡£
78 .PP
79 .\"O .BR setxattr ()
80 .\"O sets the
81 .\"O .I value
82 .\"O of the extended attribute identified by
83 .\"O .I name
84 .\"O and associated with the given
85 .\"O .I path
86 .\"O in the file system.
87 .\"O The
88 .\"O .I size
89 .\"O of the
90 .\"O .I value
91 .\"O must be specified.
92 .BR setxattr ()
93 ¤Ï¡¢¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥àÆâ¤Î»ØÄꤵ¤ì¤¿
94 .I path
95 ¤ËÂбþ¤¹¤ë¡¢Ì¾Á°
96 .I name
97 ¤Î³Èĥ°À­¤ÎÃÍ
98 .I value
99 ¤òÀßÄꤹ¤ë¡£
100 .I value
101 ¤Î
102 .I size
103 ¤Ïɬ¤º»ØÄꤷ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
104 .PP
105 .\"O .BR lsetxattr ()
106 .\"O is identical to
107 .\"O .BR setxattr (),
108 .\"O except in the case of a symbolic link, where the extended attribute is
109 .\"O set on the link itself, not the file that it refers to.
110 .BR lsetxattr ()
111 ¤Ï
112 .BR setxattr ()
113 ¤ÈƱ¤¸¤À¤¬¡¢¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤Î¾ì¹ç¤Ë¡¢¥ê¥ó¥¯¤¬»²¾È¤·¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë
114 ¤Ç¤Ï¤Ê¤¯¡¢¥ê¥ó¥¯¤½¤Î¤â¤Î¤Î³Èĥ°À­¤òÀßÄꤹ¤ëÅÀ¤À¤±¤¬°Û¤Ê¤ë¡£
115 .PP
116 .\"O .BR fsetxattr ()
117 .\"O is identical to
118 .\"O .BR setxattr (),
119 .\"O only the extended attribute is set on the open file referred to by
120 .\"O .I fd
121 .\"O (as returned by
122 .\"O .BR open (2))
123 .\"O in place of
124 .\"O .IR path .
125 .BR fsetxattr ()
126 ¤Ï
127 .BR setxattr ()
128 ¤ÈƱ¤¸¤À¤¬¡¢
129 .I path
130 ¤ÎÂå¤ï¤ê¤Ë
131 .I fd
132 ¤Ç»²¾È¤µ¤ì¤¿¥ª¡¼¥×¥óºÑ¤ß¥Õ¥¡¥¤¥ë¤Î¾ðÊó¤À¤±¤òÀßÄꤹ¤ëÅÀ¤¬°Û¤Ê¤ë
133 .RI ( filedes
134 ¤Ï
135 .BR open (2)
136 ¤Ë¤è¤Ã¤ÆÊÖ¤µ¤ì¤ë)¡£
137 .PP
138 .\"O An extended attribute name is a simple null-terminated string.
139 .\"O The
140 .\"O .I name
141 .\"O includes a namespace prefix; there may be several, disjoint
142 .\"O namespaces associated with an individual inode.
143 .\"O The
144 .\"O .I value
145 .\"O of an extended attribute is a chunk of arbitrary textual or
146 .\"O binary data of specified length.
147 ³Èĥ°À­¤Î̾Á°
148 ¤ÏÉáÄ̤ΠNULL ½ªÃ¼¤µ¤ì¤¿Ê¸»úÎó¤Ç¤¢¤ë¡£
149 .I name
150 ¤Ë¤Ï¡¢Ì¾Á°¶õ´Ö¤òɽ¤¹ÀÜƬ¼­ (prefix) ¤¬´Þ¤Þ¤ì¤ë¡£
151 ¸Ä¡¹¤Î inode ¤ËÂФ·¤Æ¡¢¸ß¤¤¤ËÆÈΩ¤Ê̾Á°¶õ´Ö¤¬Ê£¿ô¤¢¤Ã¤Æ¤â¤è¤¤¡£
152 ³Èĥ°À­¤ÎÃÍ
153 .I value
154 ¤Ï¡¢¤¢¤ë°ìÄê¤ÎŤµ¤ÎǤ°Õ¤Î¥Æ¥­¥¹¥È¡¦¥Ç¡¼¥¿¤Þ¤¿¤Ï
155 ¥Ð¥¤¥Ê¥ê¡¦¥Ç¡¼¥¿¤Î½¸¹ç¤Ç¤¢¤ë¡£
156 .PP
157 .\"O The
158 .\"O .I flags
159 .\"O argument can be used to refine the semantics of the operation.
160 Áàºî¤Î°ÕÌ£¤òÌÀ³Î¤Ë¤¹¤ë¤¿¤á¤Ë
161 .I flags
162 °ú¤­¿ô¤ò»ÈÍѤ¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
163 .\"O .B XATTR_CREATE
164 .\"O specifies a pure create, which fails if the named
165 .\"O attribute exists already.
166 .B XATTR_CREATE
167 ¤Ï°À­¤ÎºîÀ®¤À¤±¤ò¹Ô¤¦¤³¤È¤ò»ØÄꤹ¤ë¡£
168 »ØÄꤵ¤ì¤¿Ì¾Á°¤Î°À­¤¬¤¹¤Ç¤Ë¸ºß¤¹¤ë¾ì¹ç¤Ï¼ºÇÔ¤¹¤ë¡£
169 .\"O .B XATTR_REPLACE
170 .\"O specifies a pure replace operation, which fails if the
171 .\"O named attribute does not already exist.
172 .B XATTR_REPLACE
173 ¤Ï°À­¤ÎÃÖ´¹¤À¤±¤ò¹Ô¤¦¤³¤È¤ò»ØÄꤹ¤ë¡£
174 »ØÄꤵ¤ì¤¿Ì¾Á°¤Î°À­¤¬¤Þ¤À¸ºß¤·¤Ê¤¤¾ì¹ç¤Ï¼ºÇÔ¤¹¤ë¡£
175 .\"O By default (no flags), the extended attribute will be created if
176 .\"O need be, or will simply replace the value if the attribute exists.
177 ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï (¥Õ¥é¥°¤ò»ØÄꤷ¤Ê¤¤¾ì¹ç)¡¢³Èĥ°À­¤ÏɬÍפʾì¹ç¤ÏºîÀ®¤µ¤ì¡¢
178 °À­¤¬¤¹¤Ç¤Ë¸ºß¤¹¤ë¾ì¹ç¤Ï°À­ÃͤÎÃÖ´¹¤ò¹Ô¤¦¡£
179 .\"O .SH RETURN VALUE
180 .SH ÊÖ¤êÃÍ
181 .\"O On success, zero is returned.
182 .\"O On failure, \-1 is returned and
183 .\"O .I errno
184 .\"O is set appropriately.
185 À®¸ù¤·¤¿¾ì¹ç¡¢ 0 ¤¬ÊÖ¤µ¤ì¤ë¡£
186 ¼ºÇÔ¤·¤¿¾ì¹ç¡¢ \-1 ¤¬ÊÖ¤µ¤ì¡¢
187 .I errno
188 ¤ËŬÀÚ¤ÊÃͤ¬¥»¥Ã¥È¤µ¤ì¤ë¡£
189 .PP
190 .\"O If
191 .\"O .B XATTR_CREATE
192 .\"O is specified, and the attribute exists already,
193 .\"O .I errno
194 .\"O is set to
195 .\"O .BR EEXIST .
196 .B XATTR_CREATE
197 ¤¬»ØÄꤵ¤ì¡¢¤«¤Ä°À­¤¬¤¹¤Ç¤Ë¸ºß¤¹¤ë¾ì¹ç¡¢
198 .I errno
199 ¤Ë
200 .B EEXIST
201 ¤¬¥»¥Ã¥È¤µ¤ì¤ë¡£
202 .\"O If
203 .\"O .B XATTR_REPLACE
204 .\"O is specified, and the attribute does not exist,
205 .\"O .I errno
206 .\"O is set to
207 .\"O .BR ENOATTR .
208 .B XATTR_REPLACE
209 ¤¬»ØÄꤵ¤ì¡¢Â°À­¤¬¤Þ¤À¸ºß¤·¤Ê¤¤¾ì¹ç¡¢
210 .I errno
211 ¤Ë
212 .B ENOATTR
213 ¤¬¥»¥Ã¥È¤µ¤ì¤ë¡£
214 .PP
215 .\"O If there is insufficient space remaining to store the extended attribute,
216 .\"O .I errno
217 .\"O is set to either
218 .\"O .BR ENOSPC ,
219 .\"O or
220 .\"O .B EDQUOT
221 .\"O if quota enforcement was the cause.
222 ³Èĥ°À­¤òµ­²±¤¹¤ë¤Î¤Ë½½Ê¬¤Ê¥¹¥Ú¡¼¥¹¤¬»Ä¤Ã¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢
223 .I errno
224 ¤Ë
225 .B ENOSPC
226 ¤Þ¤¿¤Ï
227 .B EDQUOT
228 (quota ¤Ë¤è¤ëÀ©¸Â¤¬¸¶°ø¤Î¾ì¹ç) ¤¬¥»¥Ã¥È¤µ¤ì¤ë¡£
229 .PP
230 .\"O If extended attributes are not supported by the file system, or are disabled,
231 .\"O .I errno
232 .\"O is set to
233 .\"O .BR ENOTSUP .
234 ³Èĥ°À­¤¬¤½¤Î¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Ç¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢
235 ¤â¤·¤¯¤Ï̵¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤ë¾ì¹ç¡¢
236 .I errno
237 ¤Ë
238 .B ENOTSUP
239 ¤¬¥»¥Ã¥È¤µ¤ì¤ë¡£
240 .PP
241 .\"O The errors documented for the
242 .\"O .BR stat (2)
243 .\"O system call are also applicable here.
244 .BR stat (2)
245 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤ÎÀâÌÀ¤Ë½ñ¤«¤ì¤Æ¤¤¤ë¥¨¥é¡¼¤Ï
246 ¤³¤ì¤é¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ë¤âŬÍѤµ¤ì¤ë¡£
247 .\"O .SH VERSIONS
248 .SH ¥Ð¡¼¥¸¥ç¥ó
249 .\"O These system calls have been available on Linux since kernel 2.4;
250 .\"O glibc support is provided since version 2.3.
251 ¤³¤ì¤é¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¥«¡¼¥Í¥ë 2.4 °Ê¹ß¤Î Linux ¤ÇÍøÍѤǤ­¤ë¡£
252 glibc ¤Ç¤Î¥µ¥Ý¡¼¥È¤Ï¥Ð¡¼¥¸¥ç¥ó 2.3 °Ê¹ß¤Ç¹Ô¤ï¤ì¤Æ¤¤¤ë¡£
253 .\"O .SH "CONFORMING TO"
254 .SH ½àµò
255 .\"O These system calls are Linux-specific.
256 ¤³¤ì¤é¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï Linux Æȼ«¤Ç¤¢¤ë¡£
257 .\"O .\" .SH AUTHORS
258 .\" .SH Ãø¼Ô
259 .\"O .\" Andreas Gruenbacher,
260 .\"O .\" .RI < a.gruenbacher@computer.org >
261 .\"O .\" and the SGI XFS development team,
262 .\"O .\" .RI < linux-xfs@oss.sgi.com >.
263 .\"O .\" Please send any bug reports or comments to these addresses.
264 .\" Andreas Gruenbacher,
265 .\" .RI < a.gruenbacher@computer.org >
266 .\" ¤È SGI XFS ³«È¯¥Á¡¼¥à,
267 .\" .RI < linux-xfs@oss.sgi.com >¡£
268 .\" ¥Ð¥°¥ì¥Ý¡¼¥È¤ä¥³¥á¥ó¥È¤Ï¾åµ­¤Î¥¢¥É¥ì¥¹¤Þ¤ÇÁ÷¤Ã¤Æ²¼¤µ¤¤¡£
269 .\"O .SH SEE ALSO
270 .SH ´ØÏ¢¹àÌÜ
271 .BR getfattr (1),
272 .BR setfattr (1),
273 .BR getxattr (2),
274 .BR listxattr (2),
275 .BR open (2),
276 .BR removexattr (2),
277 .BR stat (2),
278 .BR attr (5),
279 .BR symlink (7)