xattr.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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, write to the Free
  13. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  14. 02111-1307 USA. */
  15. #ifndef _SYS_XATTR_H
  16. #define _SYS_XATTR_H 1
  17. #include <features.h>
  18. #include <sys/types.h>
  19. __BEGIN_DECLS
  20. /* The following constants should be used for the fifth parameter of
  21. `*setxattr'. */
  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. /* Set the attribute NAME of the file pointed to by PATH to VALUE (which
  30. is SIZE bytes long). Return 0 on success, -1 for errors. */
  31. extern int setxattr (__const char *__path, __const char *__name,
  32. __const void *__value, size_t __size, int __flags)
  33. __THROW;
  34. /* Set the attribute NAME of the file pointed to by PATH to VALUE (which is
  35. SIZE bytes long), not following symlinks for the last pathname component.
  36. Return 0 on success, -1 for errors. */
  37. extern int lsetxattr (__const char *__path, __const char *__name,
  38. __const void *__value, size_t __size, int __flags)
  39. __THROW;
  40. /* Set the attribute NAME of the file descriptor FD to VALUE (which is SIZE
  41. bytes long). Return 0 on success, -1 for errors. */
  42. extern int fsetxattr (int __fd, __const char *__name, __const void *__value,
  43. size_t __size, int __flags) __THROW;
  44. /* Get the attribute NAME of the file pointed to by PATH to VALUE (which is
  45. SIZE bytes long). Return 0 on success, -1 for errors. */
  46. extern ssize_t getxattr (__const char *__path, __const char *__name,
  47. void *__value, size_t __size) __THROW;
  48. /* Get the attribute NAME of the file pointed to by PATH to VALUE (which is
  49. SIZE bytes long), not following symlinks for the last pathname component.
  50. Return 0 on success, -1 for errors. */
  51. extern ssize_t lgetxattr (__const char *__path, __const char *__name,
  52. void *__value, size_t __size) __THROW;
  53. /* Get the attribute NAME of the file descriptor FD to VALUE (which is SIZE
  54. bytes long). Return 0 on success, -1 for errors. */
  55. extern ssize_t fgetxattr (int __fd, __const char *__name, void *__value,
  56. size_t __size) __THROW;
  57. /* List attributes of the file pointed to by PATH into the user-supplied
  58. buffer LIST (which is SIZE bytes big). Return 0 on success, -1 for
  59. errors. */
  60. extern ssize_t listxattr (__const char *__path, char *__list, size_t __size)
  61. __THROW;
  62. /* List attributes of the file pointed to by PATH into the user-supplied
  63. buffer LIST (which is SIZE bytes big), not following symlinks for the
  64. last pathname component. Return 0 on success, -1 for errors. */
  65. extern ssize_t llistxattr (__const char *__path, char *__list, size_t __size)
  66. __THROW;
  67. /* List attributes of the file descriptor FD into the user-supplied buffer
  68. LIST (which is SIZE bytes big). Return 0 on success, -1 for errors. */
  69. extern ssize_t flistxattr (int __fd, char *__list, size_t __size)
  70. __THROW;
  71. /* Remove the attribute NAME from the file pointed to by PATH. Return 0
  72. on success, -1 for errors. */
  73. extern int removexattr (__const char *__path, __const char *__name) __THROW;
  74. /* Remove the attribute NAME from the file pointed to by PATH, not
  75. following symlinks for the last pathname component. Return 0 on
  76. success, -1 for errors. */
  77. extern int lremovexattr (__const char *__path, __const char *__name) __THROW;
  78. /* Remove the attribute NAME from the file descriptor FD. Return 0 on
  79. success, -1 for errors. */
  80. extern int fremovexattr (int __fd, __const char *__name) __THROW;
  81. __END_DECLS
  82. #endif /* sys/xattr.h */