1ATTR_SET(3)                  XFS Compatibility API                 ATTR_SET(3)
2
3
4

NAME

6       attr_set, attr_setf - set the value of a user attribute of a filesystem
7       object
8

C SYNOPSIS

10       #include <attr/attributes.h>
11
12       int attr_set (const char *path, const char *attrname,
13                     const char *attrvalue, const int valuelength,
14                     int flags);
15
16       int attr_setf (int fd, const char *attrname,
17                      const char *attrvalue, const int valuelength,
18                      int flags);
19

DESCRIPTION

21       The attr_set and attr_setf functions provide a way to create attributes
22       and set/change their values.
23
24       Path  points  to  a path name for a filesystem object, and fd refers to
25       the file descriptor associated with a file.  If the attribute  attrname
26       does not exist, an attribute with the given name and value will be cre‐
27       ated and associated with  that  indicated  filesystem  object.   If  an
28       attribute  with that name already exists on that filesystem object, the
29       existing value is replaced with the new value given in this call.   The
30       new  attribute value is copied from the attrvalue buffer for a total of
31       valuelength bytes.  The flags argument can contain the  following  sym‐
32       bols bitwise OR'ed together:
33
34       ATTR_ROOT
35              Look  for  attrname  in  the root address space, not in the user
36              address space.  (limited to use by super-user only)
37
38       ATTR_DONTFOLLOW
39              Do not follow  symbolic  links  when  resolving  a  path  on  an
40              attr_set  function  call.   The  default  is  to follow symbolic
41              links.
42
43       ATTR_CREATE
44              Return an error (EEXIST) if  an  attribute  of  the  given  name
45              already  exists  on  the  indicated filesystem object, otherwise
46              create an attribute with the given name and value.  This flag is
47              used  to  implement  a  pure create operation, without this flag
48              attr_set will create the attribute if it does not already exist.
49              An  error  (EINVAL)  will  be  returned  if both ATTR_CREATE and
50              ATTR_REPLACE are set in the same call.
51
52       ATTR_REPLACE
53              Return an error (ENOATTR) if an attribute of the given name does
54              not  already exist on the indicated filesystem object, otherwise
55              replace the existing attribute´s value  with  the  given  value.
56              This  flag  is  used  to implement a pure replacement operation,
57              without this flag attr_set will create the attribute if it  does
58              not  already  exist.  An error (EINVAL) will be returned if both
59              ATTR_CREATE and ATTR_REPLACE are set in the same call.
60
61       attr_set will fail if one or more of the following are true:
62
63       [ENOATTR]        The attribute name given is not  associated  with  the
64                        indicated  filesystem object and the ATTR_REPLACE flag
65                        bit was set.
66
67       [E2BIG]          The value of the given  attribute  is  too  large,  it
68                        exceeds  the  maximum  allowable  size of an attribute
69                        value.
70
71       [EEXIST]         The attribute name given is  already  associated  with
72                        the  indicated  filesystem  object and the ATTR_CREATE
73                        flag bit was set.
74
75       [ENOENT]         The named file does not exist.
76
77       [EPERM]          The effective user ID does not match the owner of  the
78                        file and the effective user ID is not super-user.
79
80       [ENOTDIR]        A component of the path prefix is not a directory.
81
82       [EACCES]         Search permission is denied on a component of the path
83                        prefix.
84
85       [EINVAL]         A bit was set in the flag argument that is not defined
86                        for  this  system  call,  or  both the ATTR_CREATE and
87                        ATTR_REPLACE flags bits were set.
88
89       [EFAULT]         Path, attrname, or attrvalue points outside the  allo‐
90                        cated address space of the process.
91
92       [ELOOP]          A path name lookup involved too many symbolic links.
93
94       [ENAMETOOLONG]   The length of path exceeds {MAXPATHLEN}, or a pathname
95                        component is longer than {MAXNAMELEN}.
96
97       attr_setf will fail if:
98
99       [ENOATTR]      The attribute name given  is  not  associated  with  the
100                      indicated  filesystem  object  and the ATTR_REPLACE flag
101                      bit was set.
102
103       [E2BIG]        The value of  the  given  attribute  is  too  large,  it
104                      exceeds  the  maximum  allowable  size  of  an attribute
105                      value.
106
107       [EEXIST]       The attribute name given is already associated with  the
108                      indicated filesystem object and the ATTR_CREATE flag bit
109                      was set.
110
111       [EINVAL]       A bit was set in the flag argument that is  not  defined
112                      for  this  system  call,  or  both  the  ATTR_CREATE and
113                      ATTR_REPLACE flags bits were set,  or  fd  refers  to  a
114                      socket, not a file.
115
116       [EFAULT]       Attrname,  or  attrvalue  points  outside  the allocated
117                      address space of the process.
118
119       [EBADF]        Fd does not refer to a valid descriptor.
120

DIAGNOSTICS

122       On success, zero is returned.  On error, -1 is returned, and  errno  is
123       set appropriately.
124

SEE ALSO

126       attr(1), attr_get(3), attr_list(3), attr_multi(3), and attr_remove(3).
127
128
129
130Dec 2001                      Extended Attributes                  ATTR_SET(3)
Impressum