xattr.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* Copyright (C) 2002 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. enum
  22. {
  23. XATTR_CREATE = 1, /* set value, fail if attr already exists. */
  24. #define XATTR_CREATE XATTR_CREATE
  25. XATTR_REPLACE = 2 /* set value, fail if attr does not exist. */
  26. #define XATTR_REPLACE XATTR_REPLACE
  27. };
  28. /* Set the attribute NAME of the file pointed to by PATH to VALUE (which
  29. is SIZE bytes long). Return 0 on success, -1 for errors. */
  30. extern int setxattr (const char *__path, const char *__name,
  31. const void *__value, size_t __size, int __flags)
  32. __THROW;
  33. /* Set the attribute NAME of the file pointed to by PATH to VALUE (which is
  34. SIZE bytes long), not following symlinks for the last pathname component.
  35. Return 0 on success, -1 for errors. */
  36. extern int lsetxattr (const char *__path, const char *__name,
  37. const void *__value, size_t __size, int __flags)
  38. __THROW;
  39. /* Set the attribute NAME of the file descriptor FD to VALUE (which is SIZE
  40. bytes long). Return 0 on success, -1 for errors. */
  41. extern int fsetxattr (int __fd, const char *__name, const void *__value,
  42. size_t __size, int __flags) __THROW;
  43. /* Get the attribute NAME of the file pointed to by PATH to VALUE (which is
  44. SIZE bytes long). Return 0 on success, -1 for errors. */
  45. extern ssize_t getxattr (const char *__path, const char *__name,
  46. void *__value, size_t __size) __THROW;
  47. /* Get the attribute NAME of the file pointed to by PATH to VALUE (which is
  48. SIZE bytes long), not following symlinks for the last pathname component.
  49. Return 0 on success, -1 for errors. */
  50. extern ssize_t lgetxattr (const char *__path, const char *__name,
  51. void *__value, size_t __size) __THROW;
  52. /* Get the attribute NAME of the file descriptor FD to VALUE (which is SIZE
  53. bytes long). Return 0 on success, -1 for errors. */
  54. extern ssize_t fgetxattr (int __fd, const char *__name, void *__value,
  55. size_t __size) __THROW;
  56. /* List attributes of the file pointed to by PATH into the user-supplied
  57. buffer LIST (which is SIZE bytes big). Return 0 on success, -1 for
  58. errors. */
  59. extern ssize_t listxattr (const char *__path, char *__list, size_t __size)
  60. __THROW;
  61. /* List attributes of the file pointed to by PATH into the user-supplied
  62. buffer LIST (which is SIZE bytes big), not following symlinks for the
  63. last pathname component. Return 0 on success, -1 for errors. */
  64. extern ssize_t llistxattr (const char *__path, char *__list, size_t __size)
  65. __THROW;
  66. /* List attributes of the file descriptor FD into the user-supplied buffer
  67. LIST (which is SIZE bytes big). Return 0 on success, -1 for errors. */
  68. extern ssize_t flistxattr (int __fd, char *__list, size_t __size)
  69. __THROW;
  70. /* Remove the attribute NAME from the file pointed to by PATH. Return 0
  71. on success, -1 for errors. */
  72. extern int removexattr (const char *__path, const char *__name) __THROW;
  73. /* Remove the attribute NAME from the file pointed to by PATH, not
  74. following symlinks for the last pathname component. Return 0 on
  75. success, -1 for errors. */
  76. extern int lremovexattr (const char *__path, const char *__name) __THROW;
  77. /* Remove the attribute NAME from the file descriptor FD. Return 0 on
  78. success, -1 for errors. */
  79. extern int fremovexattr (int __fd, const char *__name) __THROW;
  80. __END_DECLS
  81. #endif /* sys/xattr.h */