1GETXATTR(2)                      System calls                      GETXATTR(2)
2
3
4

NAME

6       getxattr, lgetxattr, fgetxattr - retrieve an extended attribute value
7

SYNOPSIS

9       #include <sys/types.h>
10       #include <attr/xattr.h>
11
12       ssize_t getxattr (const char *path, const char *name,
13                            void *value, size_t size);
14       ssize_t lgetxattr (const char *path, const char *name,
15                            void *value, size_t size);
16       ssize_t fgetxattr (int filedes, const char *name,
17                            void *value, size_t size);
18

DESCRIPTION

20       Extended attributes are name:value pairs associated with inodes (files,
21       directories,  symlinks,  etc).   They  are  extensions  to  the  normal
22       attributes which are associated with all inodes in the system (i.e. the
23       stat(2) data).  A complete overview of extended attributes concepts can
24       be found in attr(5).
25
26       getxattr  retrieves  the  value of the extended attribute identified by
27       name and associated with the given path in the filesystem.  The  length
28       of the attribute value is returned.
29
30       lgetxattr  is  identical  to getxattr, except in the case of a symbolic
31       link, where the link itself is  interrogated,  not  the  file  that  it
32       refers to.
33
34       fgetxattr  is  identical  to getxattr, only the open file pointed to by
35       filedes (as returned by open(2)) is interrogated in place of path.
36
37       An extended attribute name is a  simple  NULL-terminated  string.   The
38       name  includes  a  namespace  prefix  -  there may be several, disjoint
39       namespaces associated with  an  individual  inode.   The  value  of  an
40       extended  attribute  is  a chunk of arbitrary textual or binary data of
41       specified length.
42
43       An empty buffer of size zero can be passed into these calls  to  return
44       the  current size of the named extended attribute, which can be used to
45       estimate the size of a buffer which is sufficiently large to  hold  the
46       value associated with the extended attribute.
47
48       The  interface  is  designed to allow guessing of initial buffer sizes,
49       and to enlarge buffers when the return value indicates that the  buffer
50       provided was too small.
51

RETURN VALUE

53       On  success,  a  positive number is returned indicating the size of the
54       extended attribute value.  On failure, -1 is returned and errno is  set
55       appropriately.
56
57       If  the named attribute does not exist, or the process has no access to
58       this attribute, errno is set to ENOATTR.
59
60       If the size of the value buffer is too small to hold the result,  errno
61       is set to ERANGE.
62
63       If extended attributes are not supported by the filesystem, or are dis‐
64       abled, errno is set to ENOTSUP.
65
66       The errors documented for the stat(2) system call are  also  applicable
67       here.
68

AUTHORS

70       Andreas Gruenbacher, <a.gruenbacher@bestbits.at> and the SGI XFS devel‐
71       opment team, <linux-xfs@oss.sgi.com>.  Please send any bug  reports  or
72       comments to these addresses.
73

SEE ALSO

75       getfattr(1),  setfattr(1), open(2), stat(2), setxattr(2), listxattr(2),
76       removexattr(2), and attr(5).
77
78
79
80Dec 2001                      Extended Attributes                  GETXATTR(2)
Impressum