[BZ #9701]
[glibc.git] / misc / sys / xattr.h
blob2737f90bde4f61f9c9876130a6e0848358be04c4
1 /* Copyright (C) 2002 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 USA. */
19 #ifndef _SYS_XATTR_H
20 #define _SYS_XATTR_H 1
22 #include <features.h>
23 #include <sys/types.h>
26 __BEGIN_DECLS
28 /* The following constants should be used for the fifth parameter of
29 `*setxattr'. */
30 enum
32 XATTR_CREATE = 1, /* set value, fail if attr already exists. */
33 #define XATTR_CREATE XATTR_CREATE
34 XATTR_REPLACE = 2 /* set value, fail if attr does not exist. */
35 #define XATTR_REPLACE XATTR_REPLACE
38 /* Set the attribute NAME of the file pointed to by PATH to VALUE (which
39 is SIZE bytes long). Return 0 on success, -1 for errors. */
40 extern int setxattr (__const char *__path, __const char *__name,
41 __const void *__value, size_t __size, int __flags)
42 __THROW;
44 /* Set the attribute NAME of the file pointed to by PATH to VALUE (which is
45 SIZE bytes long), not following symlinks for the last pathname component.
46 Return 0 on success, -1 for errors. */
47 extern int lsetxattr (__const char *__path, __const char *__name,
48 __const void *__value, size_t __size, int __flags)
49 __THROW;
51 /* Set the attribute NAME of the file descriptor FD to VALUE (which is SIZE
52 bytes long). Return 0 on success, -1 for errors. */
53 extern int fsetxattr (int __fd, __const char *__name, __const void *__value,
54 size_t __size, int __flags) __THROW;
56 /* Get the attribute NAME of the file pointed to by PATH to VALUE (which is
57 SIZE bytes long). Return 0 on success, -1 for errors. */
58 extern ssize_t getxattr (__const char *__path, __const char *__name,
59 void *__value, size_t __size) __THROW;
61 /* Get the attribute NAME of the file pointed to by PATH to VALUE (which is
62 SIZE bytes long), not following symlinks for the last pathname component.
63 Return 0 on success, -1 for errors. */
64 extern ssize_t lgetxattr (__const char *__path, __const char *__name,
65 void *__value, size_t __size) __THROW;
67 /* Get the attribute NAME of the file descriptor FD to VALUE (which is SIZE
68 bytes long). Return 0 on success, -1 for errors. */
69 extern ssize_t fgetxattr (int __fd, __const char *__name, void *__value,
70 size_t __size) __THROW;
72 /* List attributes of the file pointed to by PATH into the user-supplied
73 buffer LIST (which is SIZE bytes big). Return 0 on success, -1 for
74 errors. */
75 extern ssize_t listxattr (__const char *__path, char *__list, size_t __size)
76 __THROW;
78 /* List attributes of the file pointed to by PATH into the user-supplied
79 buffer LIST (which is SIZE bytes big), not following symlinks for the
80 last pathname component. Return 0 on success, -1 for errors. */
81 extern ssize_t llistxattr (__const char *__path, char *__list, size_t __size)
82 __THROW;
84 /* List attributes of the file descriptor FD into the user-supplied buffer
85 LIST (which is SIZE bytes big). Return 0 on success, -1 for errors. */
86 extern ssize_t flistxattr (int __fd, char *__list, size_t __size)
87 __THROW;
89 /* Remove the attribute NAME from the file pointed to by PATH. Return 0
90 on success, -1 for errors. */
91 extern int removexattr (__const char *__path, __const char *__name) __THROW;
93 /* Remove the attribute NAME from the file pointed to by PATH, not
94 following symlinks for the last pathname component. Return 0 on
95 success, -1 for errors. */
96 extern int lremovexattr (__const char *__path, __const char *__name) __THROW;
98 /* Remove the attribute NAME from the file descriptor FD. Return 0 on
99 success, -1 for errors. */
100 extern int fremovexattr (int __fd, __const char *__name) __THROW;
102 __END_DECLS
104 #endif /* sys/xattr.h */