.\" Copyright (C) Andreas Gruenbacher, February 2001 .\" Copyright (C) Silicon Graphics Inc, September 2001 .\" .\" %%%LICENSE_START(GPLv2+_DOC_FULL) .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License as .\" published by the Free Software Foundation; either version 2 of .\" the License, or (at your option) any later version. .\" .\" The GNU General Public License's references to "object code" .\" and "executables" are to be interpreted as the output of any .\" document formatting or typesetting system, including .\" intermediate and printed output. .\" .\" This manual is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public .\" License along with this manual; if not, see .\" . .\" %%%LICENSE_END .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2003 Akihiro MOTOKI .\" all rights reserved. .\" Translated Tue Jul 8 02:47:19 JST 2003 .\" by Akihiro MOTOKI .\" Updated 2013-03-26, Akihiro MOTOKI .\" .TH GETXATTR 2 2020\-06\-09 Linux "Linux Programmer's Manual" .SH 名前 getxattr, lgetxattr, fgetxattr \- 拡張属性の値を取得する .SH 書式 .fam C .nf \fB#include \fP \fB#include \fP .PP \fBssize_t getxattr(const char\ *\fP\fIpath\fP\fB, const char\ *\fP\fIname\fP\fB,\fP \fB void\ *\fP\fIvalue\fP\fB, size_t \fP\fIsize\fP\fB);\fP \fBssize_t lgetxattr(const char\ *\fP\fIpath\fP\fB, const char\ *\fP\fIname\fP\fB,\fP \fB void\ *\fP\fIvalue\fP\fB, size_t \fP\fIsize\fP\fB);\fP \fBssize_t fgetxattr(int \fP\fIfd\fP\fB, const char\ *\fP\fIname\fP\fB,\fP \fB void\ *\fP\fIvalue\fP\fB, size_t \fP\fIsize\fP\fB);\fP .fi .fam T .SH 説明 Extended attributes are \fIname\fP:\fIvalue\fP pairs associated with inodes (files, directories, symbolic links, etc.). They are extensions to the normal attributes which are associated with all inodes in the system (i.e., the \fBstat\fP(2) data). A complete overview of extended attributes concepts can be found in \fBxattr\fP(7). .PP \fBgetxattr\fP() retrieves the value of the extended attribute identified by \fIname\fP and associated with the given \fIpath\fP in the filesystem. The attribute value is placed in the buffer pointed to by \fIvalue\fP; \fIsize\fP specifies the size of that buffer. The return value of the call is the number of bytes placed in \fIvalue\fP. .PP \fBlgetxattr\fP() は \fBgetxattr\fP() と同じだが、シンボリックリンクの場合に、リンクが参照しているファイル ではなく、リンクそのものの情報を取得する点だけが異なる。 .PP \fBfgetxattr\fP() は \fBgetxattr\fP() と同じだが、 \fIpath\fP の代わりに \fIfd\fP で参照されたオープン済みファイルの情報だけを取得する点が異なる (\fIfd\fP は \fBopen\fP(2) によって返される)。 .PP An extended attribute \fIname\fP is a null\-terminated string. The name includes a namespace prefix; there may be several, disjoint namespaces associated with an individual inode. The value of an extended attribute is a chunk of arbitrary textual or binary data that was assigned using \fBsetxattr\fP(2). .PP If \fIsize\fP is specified as zero, these calls return the current size of the named extended attribute (and leave \fIvalue\fP unchanged). This can be used to determine the size of the buffer that should be supplied in a subsequent call. (But, bear in mind that there is a possibility that the attribute value may change between the two calls, so that it is still necessary to check the return status from the second call.) .SH 返り値 On success, these calls return a nonnegative value which is the size (in bytes) of the extended attribute value. On failure, \-1 is returned and \fIerrno\fP is set appropriately. .SH エラー .TP \fBE2BIG\fP The size of the attribute value is larger than the maximum size allowed; the attribute cannot be retrieved. This can happen on filesystems that support very large attribute values such as NFSv4, for example. .TP \fBENODATA\fP .\" .RB ( ENOATTR .\" is defined to be a synonym for .\" .BR ENODATA .\" in .\" .IR .) The named attribute does not exist, or the process has no access to this attribute. .TP \fBENOTSUP\fP 拡張属性がそのファイルシステムでサポートされていない、 もしくは無効になっている。 .TP \fBERANGE\fP \fIvalue\fP バッファーの大きさ \fIsize\fP が結果を保持するのに十分な大きさでなかった。 .PP 上記に加えて、 \fBstat\fP(2) に書かれているエラーが発生する場合もある。 .SH バージョン これらのシステムコールはカーネル 2.4 以降の Linux で利用できる。 glibc でのサポートはバージョン 2.3 以降で行われている。 .SH 準拠 .\" .SH AUTHORS .\" Andreas Gruenbacher, .\" .RI < a.gruenbacher@computer.org > .\" and the SGI XFS development team, .\" .RI < linux-xfs@oss.sgi.com >. .\" Please send any bug reports or comments to these addresses. これらのシステムコールは Linux 独自である。 .SH 例 \fBlistxattr\fP(2) を参照。 .SH 関連項目 \fBgetfattr\fP(1), \fBsetfattr\fP(1), \fBlistxattr\fP(2), \fBopen\fP(2), \fBremovexattr\fP(2), \fBsetxattr\fP(2), \fBstat\fP(2), \fBsymlink\fP(7), \fBxattr\fP(7) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は \%https://www.kernel.org/doc/man\-pages/ に書かれている。