1ATTR_GET(3) XFS Compatibility API ATTR_GET(3)
2
3
4
6 attr_get, attr_getf - get the value of a user attribute of a filesystem
7 object
8
10 #include <attr/attributes.h>
11
12 int attr_get (const char *path, const char *attrname,
13 char *attrvalue, int *valuelength, int flags);
14
15 int attr_getf (int fd, const char *attrname,
16 char *attrvalue, int *valuelength, int flags);
17
19 The attr_get and attr_getf functions provide a way to retrieve the
20 value of an attribute.
21
22 Path points to a path name for a filesystem object, and fd refers to
23 the file descriptor associated with a file. If the attribute attrname
24 exists, the value associated with it will be copied into the attrvalue
25 buffer. The valuelength argument is an input/output argument that on
26 the call to attr_get should contain the maximum size of attribute value
27 the process is willing to accept. On return, the valuelength will have
28 been modified to show the actual size of the attribute value returned.
29 The flags argument can contain the following symbols bitwise OR'ed
30 together:
31
32 ATTR_ROOT
33 Look for attrname in the root address space, not in the user
34 address space. (limited to use by super-user only)
35
36 ATTR_DONTFOLLOW
37 Do not follow symbolic links when resolving a path on an
38 attr_get function call. The default is to follow symbolic
39 links.
40
41 attr_get will fail if one or more of the following are true:
42
43 [ENOATTR] The attribute name given is not associated with the
44 indicated filesystem object.
45
46 [E2BIG] The value of the given attribute is too large to fit
47 into the buffer. The integer that the valuelength
48 argument points to has been modified to show the
49 actual number of bytes that would be required to store
50 the value of that attribute.
51
52 [ENOENT] The named file does not exist.
53
54 [EPERM] The effective user ID does not match the owner of the
55 file and the effective user ID is not super-user.
56
57 [ENOTDIR] A component of the path prefix is not a directory.
58
59 [EACCES] Search permission is denied on a component of the path
60 prefix.
61
62 [EINVAL] A bit was set in the flag argument that is not defined
63 for this system call.
64
65 [EFAULT] Path, attrname, attrvalue, or valuelength points out‐
66 side the allocated address space of the process.
67
68 [ELOOP] A path name lookup involved too many symbolic links.
69
70 [ENAMETOOLONG] The length of path exceeds {MAXPATHLEN}, or a pathname
71 component is longer than {MAXNAMELEN}.
72
73 attr_getf will fail if:
74
75 [ENOATTR] The attribute name given is not associated with the
76 indicated filesystem object.
77
78 [E2BIG] The value of the given attribute is too large to fit
79 into the buffer. The integer that the valuelength argu‐
80 ment points to has been modified to show the actual
81 numnber of bytes that would be required to store the
82 value of that attribute.
83
84 [EINVAL] A bit was set in the flag argument that is not defined
85 for this system call, or fd refers to a socket, not a
86 file.
87
88 [EFAULT] Attrname, attrvalue, or valuelength points outside the
89 allocated address space of the process.
90
91 [EBADF] Fd does not refer to a valid descriptor.
92
94 On success, zero is returned. On error, -1 is returned, and errno is
95 set appropriately.
96
98 attr(1), attr_list(3), attr_multi(3), attr_remove(3), and attr_set(3).
99
100
101
102Dec 2001 Extended Attributes ATTR_GET(3)