Seth Woolley's Man Viewer

attr_multi(3) - attr_multi, attr_multif - manipulate multiple user attributes on a filesystem object at once - man 3 attr_multi

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

ATTR_MULTI(3)                XFS Compatibility API               ATTR_MULTI(3)



NAME
       attr_multi,  attr_multif  -  manipulate  multiple  user attributes on a
       filesystem object at once

C SYNOPSIS
       #include <attr(1,5)/attributes.h>

       int attr_multi (const char *path, attr_multiop_t *oplist,
                       int count, int flags);

       int attr_multif (int fd, attr_multiop_t *oplist,
                        int count, int flags);

DESCRIPTION
       The attr_multi and attr_multif functions provide a way  to  operate  on
       multiple attributes of a filesystem object at once.

       Path  points  to  a path name for a filesystem object, and fd refers to
       the file(1,n) descriptor associated with a file.  The oplist is an array  of
       attr_multiop_t structures.  Each element in(1,8) that array describes a sin-
       gle attribute operation and provides all the  information  required  to
       carry  out  that  operation and to check for success or failure of that
       operation.  Count tells how many elements are in(1,8) the oplist array.

       The contents of an attr_multiop_t structure include the following  mem-
       bers:

          int am_opcode; /* which operation to perform (see below) */
          int am_error; /* [out arg] result of this sub-op (an errno) */
          char *am_attrname; /* attribute name to work with */
          char *am_attrvalue; /* [in(1,8)/out arg] attribute value (raw(3x,7,8,3x cbreak) bytes) */
          int am_length; /* [in(1,8)/out arg] length of value */
          int am_flags; /* flags (bit-wise OR of #defines below) */

       The  am_opcode  field defines how the remaining fields are to be inter-
       preted and can take on one of the following values:

          ATTR_OP_GET /* return the indicated attr(1,5)'s value */
          ATTR_OP_SET /* set(7,n,1 builtins)/create the indicated attr(1,5)/value pair */
          ATTR_OP_REMOVE /* remove the indicated attr(1,5) */

       The am_error field will contain the appropriate error(8,n)  result  code  if(3,n)
       that  sub-operation  fails.  The result codes for a given sub-operation
       are a subset of the result codes that are possible from the correspond-
       ing  single-attribute function call.  For example, the result code pos-
       sible from an ATTR_OP_GET sub-operation are a subset of those that  can
       be returned from an attr_get(3,3x,3x PAIR_NUMBER) function call.

       The  am_attrname  field is a pointer to a NULL terminated string(3,n) giving
       the attribute name that the sub-operation should operate on.

       The am_attrvalue, am_length and am_flags fields are used to  store  the
       value of the named(5,8) attribute, and some control flags for that sub-oper-
       ation, respectively.  Their use varies depending on the  value  of  the
       am_opcode field.

       ATTR_OP_GET
              The  am_attrvalue field is a pointer to a empty buffer that will
              be overwritten with the  value  of  the  named(5,8)  attribute.   The
              am_length field is initially the total size of the memory buffer
              that the am_attrvalue field points to.  After the operation, the
              am_length  field  contains  the  actual  size of the attributes
              value.  The am_flags field may be set(7,n,1 builtins) to the ATTR_ROOT flag.  If
              the process has appropriate priviledges, the ROOT namespace will
              be searched for the named(5,8) attribute, otherwise the  USER  names-
              pace will be searched.

       ATTR_OP_SET
              The  am_attrvalue and am_length fields contain the new value for
              the given attribute name and its length.  The ATTR_ROOT flag may
              be  set(7,n,1 builtins)  in(1,8)  the am_flags field.  If the process has appropriate
              priviledges, the ROOT namespace will be searched for  the  named(5,8)
              attribute,  otherwise  the USER namespace will be searched.  The
              ATTR_CREATE and the ATTR_REPLACE flags may also be  set(7,n,1 builtins)  in(1,8)  the
              am_flags  field  (but  not  simultaneously).  If the ATTR_CREATE
              flag is set(7,n,1 builtins), the sub-operation will set(7,n,1 builtins) the  am_error  field  to
              EEXIST   if(3,n)   the   named(5,8)  attribute  already  exists.   If  the
              ATTR_REPLACE  flag  is  set(7,n,1 builtins),  the  sub-operation  will  set(7,n,1 builtins)  the
              am_error  field  to  ENOATTR  if(3,n)  the  named(5,8)  attribute does not
              already exist.  If neither of those two flags are  set(7,n,1 builtins)  and  the
              attribute  does  not  exist,  then the attribute will be created
              with the given value.  If neither of those two flags are set(7,n,1 builtins) and
              the  attribute  already  exists, then the value will be replaced
              with the given value.

       ATTR_OP_REMOVE
              The am_attrvalue and am_length  fields  are  not  used  and  are
              ignored.   The  am_flags field may be set(7,n,1 builtins) to the ATTR_ROOT flag.
              If the process has appropriate priviledges, the  ROOT  namespace
              will  be  searched  for  the named(5,8) attribute, otherwise the USER
              namespace will be searched.

       The flags argument to the attr_multi call is used to control  following
       of  symbolic links in(1,8) the path argument.  The default is to follow sym-
       bolic links, flags should be set(7,n,1 builtins) to ATTR_DONTFOLLOW to not follow  sym-
       bolic links.

       attr_multi will fail if(3,n) one or more of the following are true:

       [ENOENT]         The named(5,8) file(1,n) does not exist.

       [EPERM]          The  effective user ID does not match the owner of the
                        file(1,n) and the effective user ID is not super-user.

       [ENOTDIR]        A component of the path prefix is not a directory.

       [EACCES]         Search permission is denied on a component of the path
                        prefix.

       [EINVAL]         A  bit  other than ATTR_DONTFOLLOW was set(7,n,1 builtins) in(1,8) the flag
                        argument.

       [EFAULT]         Path, or oplist points outside the  allocated  address
                        space of the process.

       [ELOOP]          A path name lookup involved too many symbolic links.

       [ENAMETOOLONG]   The length of path exceeds {MAXPATHLEN}, or a pathname
                        component is longer than {MAXNAMELEN}.

       attr_multif will fail if:

       [EINVAL]       A bit was set(7,n,1 builtins) in(1,8) the flag argument, or fd  refers  to  a
                      socket(2,7,n), not a file.

       [EFAULT]       Oplist points outside the allocated address space of the
                      process.

       [EBADF]        Fd does not refer to a valid descriptor.

DIAGNOSTICS
       On success, zero is returned.  On error(8,n), -1 is returned, and  errno  is
       set(7,n,1 builtins)  appropriately.   Note that the individual operations listed in(1,8) the
       oplist array each have their own error(8,n) return fields.  The errno  vari-
       able  only  records  the  result of the attr_multi call itself, not the
       result of any of the sub-operations.

SEE ALSO
       attr(1,5)(1), attr_get(3,3x,3x PAIR_NUMBER)(3), attr_remove(3), and attr_set(3,3x,3x PAIR_NUMBER)(3).



Dec 2001                      Extended Attributes                ATTR_MULTI(3)

References for this manual (incoming links)