xattr.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /* Copyright (C) 2002-2016 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, see
  13. <http://www.gnu.org/licenses/>. */
  14. #ifndef _SYS_XATTR_H
  15. #define _SYS_XATTR_H 1
  16. #include <features.h>
  17. #include <sys/types.h>
  18. __BEGIN_DECLS
  19. /* The following constants should be used for the fifth parameter of
  20. `*setxattr'. */
  21. #ifndef __USE_KERNEL_XATTR_DEFS
  22. enum
  23. {
  24. XATTR_CREATE = 1, /* set value, fail if attr already exists. */
  25. #define XATTR_CREATE XATTR_CREATE
  26. XATTR_REPLACE = 2 /* set value, fail if attr does not exist. */
  27. #define XATTR_REPLACE XATTR_REPLACE
  28. };
  29. #endif
  30. /* Set the attribute NAME of the file pointed to by PATH to VALUE (which
  31. is SIZE bytes long). Return 0 on success, -1 for errors. */
  32. extern int setxattr (const char *__path, const char *__name,
  33. const void *__value, size_t __size, int __flags)
  34. __THROW;
  35. /* Set the attribute NAME of the file pointed to by PATH to VALUE (which is
  36. SIZE bytes long), not following symlinks for the last pathname component.
  37. Return 0 on success, -1 for errors. */
  38. extern int lsetxattr (const char *__path, const char *__name,
  39. const void *__value, size_t __size, int __flags)
  40. __THROW;
  41. /* Set the attribute NAME of the file descriptor FD to VALUE (which is SIZE
  42. bytes long). Return 0 on success, -1 for errors. */
  43. extern int fsetxattr (int __fd, const char *__name, const void *__value,
  44. size_t __size, int __flags) __THROW;
  45. /* Get the attribute NAME of the file pointed to by PATH to VALUE (which is
  46. SIZE bytes long). Return 0 on success, -1 for errors. */
  47. extern ssize_t getxattr (const char *__path, const char *__name,
  48. void *__value, size_t __size) __THROW;
  49. /* Get the attribute NAME of the file pointed to by PATH to VALUE (which is
  50. SIZE bytes long), not following symlinks for the last pathname component.
  51. Return 0 on success, -1 for errors. */
  52. extern ssize_t lgetxattr (const char *__path, const char *__name,
  53. void *__value, size_t __size) __THROW;
  54. /* Get the attribute NAME of the file descriptor FD to VALUE (which is SIZE
  55. bytes long). Return 0 on success, -1 for errors. */
  56. extern ssize_t fgetxattr (int __fd, const char *__name, void *__value,
  57. size_t __size) __THROW;
  58. /* List attributes of the file pointed to by PATH into the user-supplied
  59. buffer LIST (which is SIZE bytes big). Return 0 on success, -1 for
  60. errors. */
  61. extern ssize_t listxattr (const char *__path, char *__list, size_t __size)
  62. __THROW;
  63. /* List attributes of the file pointed to by PATH into the user-supplied
  64. buffer LIST (which is SIZE bytes big), not following symlinks for the
  65. last pathname component. Return 0 on success, -1 for errors. */
  66. extern ssize_t llistxattr (const char *__path, char *__list, size_t __size)
  67. __THROW;
  68. /* List attributes of the file descriptor FD into the user-supplied buffer
  69. LIST (which is SIZE bytes big). Return 0 on success, -1 for errors. */
  70. extern ssize_t flistxattr (int __fd, char *__list, size_t __size)
  71. __THROW;
  72. /* Remove the attribute NAME from the file pointed to by PATH. Return 0
  73. on success, -1 for errors. */
  74. extern int removexattr (const char *__path, const char *__name) __THROW;
  75. /* Remove the attribute NAME from the file pointed to by PATH, not
  76. following symlinks for the last pathname component. Return 0 on
  77. success, -1 for errors. */
  78. extern int lremovexattr (const char *__path, const char *__name) __THROW;
  79. /* Remove the attribute NAME from the file descriptor FD. Return 0 on
  80. success, -1 for errors. */
  81. extern int fremovexattr (int __fd, const char *__name) __THROW;
  82. __END_DECLS
  83. #endif /* sys/xattr.h */