(root)/
tar-1.35/
lib/
xattr-at.h
       1  /* Prototypes for openat-style fd-relative functions for operating with
       2     extended file attributes.
       3  
       4     Copyright 2012-2023 Free Software Foundation, Inc.
       5  
       6     This program is free software: you can redistribute it and/or modify
       7     it under the terms of the GNU General Public License as published by
       8     the Free Software Foundation, either version 3 of the License, or
       9     (at your option) any later version.
      10  
      11     This program is distributed in the hope that it will be useful,
      12     but WITHOUT ANY WARRANTY; without even the implied warranty of
      13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14     GNU General Public License for more details.
      15  
      16     You should have received a copy of the GNU General Public License
      17     along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
      18  
      19  #ifndef XATTRS_AT_H
      20  #define XATTRS_AT_H
      21  
      22  #include <sys/types.h>
      23  #if defined(HAVE_SYS_XATTR_H)
      24  # include <sys/xattr.h>
      25  #elif defined(HAVE_ATTR_XATTR_H)
      26  # include <attr/xattr.h>
      27  #endif
      28  
      29  #include <errno.h>
      30  #ifndef ENOATTR
      31  # define ENOATTR ENODATA        /* No such attribute */
      32  #endif
      33  
      34  /* These are the dir-fd-relative variants of the functions without the
      35     "at" suffix.  For example, setxattrat (AT_FDCWD, path, name, value, size,
      36     flags &c) is usually equivalent to setxattr (file, name, value, size,
      37     flags).  For more info use the setxattr(2), getxattr(2) or listxattr(2)
      38     manpages. */
      39  
      40  /* dir-fd-relative setxattr.  Operation sets the VALUE of the extended
      41     attribute identified by NAME and associated with the given PATH in the
      42     filesystem relatively to directory identified by DIR_FD.  See the
      43     setxattr(2) manpage for the description of all parameters. */
      44  int setxattrat (int dir_fd, const char *path, const char *name,
      45                  const void *value, size_t size, int flags);
      46  
      47  /* dir-fd-relative lsetxattr.  This function is just like setxattrat,
      48     except when DIR_FD and FILE specify a symlink:  lsetxattrat operates on the
      49     symlink, while the setxattrat operates on the referent of the symlink.  */
      50  int lsetxattrat (int dir_fd, const char *path, const char *name,
      51                   const void *value, size_t size, int flags);
      52  
      53  /* dir-fd-relative getxattr.  Operation gets the VALUE of the extended
      54     attribute idenfified by NAME and associated with the given PATH in the
      55     filesystem relatively to directory identified by DIR_FD.  For more info
      56     about all parameters see the getxattr(2) manpage. */
      57  ssize_t getxattrat (int dir_fd, const char *path, const char *name,
      58                      void *value, size_t size);
      59  
      60  /* dir-fd-relative lgetxattr.  This function is just like getxattrat,
      61     except when DIR_FD and FILE specify a symlink:  lgetxattrat operates on the
      62     symlink, while the getxattrat operates on the referent of the symlink.  */
      63  ssize_t lgetxattrat (int dir_fd, const char *path, const char *name,
      64                       void *value, size_t size);
      65  
      66  /* dir-fd-relative listxattr.  Obtain the list of extended attributes names.  For
      67     more info see the listxattr(2) manpage. */
      68  ssize_t listxattrat (int dir_fd, const char *path, char *list, size_t size);
      69  
      70  /* dir-fd-relative llistxattr.  This function is just like listxattrat,
      71     except when DIR_FD and FILE specify a symlink:  llistxattr operates on the
      72     symlink, while the listxattrat operates on the referent of the symlink.  */
      73  ssize_t llistxattrat (int dir_fd, const char *path, char *list, size_t size);
      74  
      75  #endif /* XATTRS_AT_H */