]> git.ipfire.org Git - thirdparty/glibc.git/blob - misc/sys/xattr.h
socket: Use may_alias on sockaddr structs (bug 19622)
[thirdparty/glibc.git] / misc / sys / xattr.h
1 /* Copyright (C) 2002-2024 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
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.
8
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.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18 #ifndef _SYS_XATTR_H
19 #define _SYS_XATTR_H 1
20
21 #include <features.h>
22 #include <sys/types.h>
23
24
25 __BEGIN_DECLS
26
27 /* The following constants should be used for the fifth parameter of
28 `*setxattr'. */
29 #ifndef __USE_KERNEL_XATTR_DEFS
30 enum
31 {
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
36 };
37 #endif
38
39 /* Set the attribute NAME of the file pointed to by PATH to VALUE (which
40 is SIZE bytes long). Return 0 on success, -1 for errors. */
41 extern int setxattr (const char *__path, const char *__name,
42 const void *__value, size_t __size, int __flags)
43 __THROW __attr_access ((__read_only__, 3, 4));
44
45 /* Set the attribute NAME of the file pointed to by PATH to VALUE (which is
46 SIZE bytes long), not following symlinks for the last pathname component.
47 Return 0 on success, -1 for errors. */
48 extern int lsetxattr (const char *__path, const char *__name,
49 const void *__value, size_t __size, int __flags)
50 __THROW __attr_access ((__read_only__, 3, 4));
51
52 /* Set 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 int fsetxattr (int __fd, const char *__name, const void *__value,
55 size_t __size, int __flags)
56 __THROW __attr_access ((__read_only__, 3, 4));
57
58 /* Get the attribute NAME of the file pointed to by PATH to VALUE (which is
59 SIZE bytes long). Return 0 on success, -1 for errors. */
60 extern ssize_t getxattr (const char *__path, const char *__name,
61 void *__value, size_t __size)
62 __THROW __attr_access ((__write_only__, 3, 4));
63
64 /* Get the attribute NAME of the file pointed to by PATH to VALUE (which is
65 SIZE bytes long), not following symlinks for the last pathname component.
66 Return 0 on success, -1 for errors. */
67 extern ssize_t lgetxattr (const char *__path, const char *__name,
68 void *__value, size_t __size)
69 __THROW __attr_access ((__write_only__, 3, 4));
70
71 /* Get the attribute NAME of the file descriptor FD to VALUE (which is SIZE
72 bytes long). Return 0 on success, -1 for errors. */
73 extern ssize_t fgetxattr (int __fd, const char *__name, void *__value,
74 size_t __size)
75 __THROW __attr_access ((__write_only__, 3, 4));
76
77 /* List attributes of the file pointed to by PATH into the user-supplied
78 buffer LIST (which is SIZE bytes big). Return 0 on success, -1 for
79 errors. */
80 extern ssize_t listxattr (const char *__path, char *__list, size_t __size)
81 __THROW __attr_access ((__write_only__, 2, 3));
82
83 /* List attributes of the file pointed to by PATH into the user-supplied
84 buffer LIST (which is SIZE bytes big), not following symlinks for the
85 last pathname component. Return 0 on success, -1 for errors. */
86 extern ssize_t llistxattr (const char *__path, char *__list, size_t __size)
87 __THROW __attr_access ((__write_only__, 2, 3));
88
89 /* List attributes of the file descriptor FD into the user-supplied buffer
90 LIST (which is SIZE bytes big). Return 0 on success, -1 for errors. */
91 extern ssize_t flistxattr (int __fd, char *__list, size_t __size)
92 __THROW __attr_access ((__write_only__, 2, 3));
93
94 /* Remove the attribute NAME from the file pointed to by PATH. Return 0
95 on success, -1 for errors. */
96 extern int removexattr (const char *__path, const char *__name) __THROW;
97
98 /* Remove the attribute NAME from the file pointed to by PATH, not
99 following symlinks for the last pathname component. Return 0 on
100 success, -1 for errors. */
101 extern int lremovexattr (const char *__path, const char *__name) __THROW;
102
103 /* Remove the attribute NAME from the file descriptor FD. Return 0 on
104 success, -1 for errors. */
105 extern int fremovexattr (int __fd, const char *__name) __THROW;
106
107 __END_DECLS
108
109 #endif /* sys/xattr.h */