xref: /haiku/headers/compatibility/gnu/sys/xattr.h (revision c90684742e7361651849be4116d0e5de3a817194)
1 /*
2  * Copyright 2009, Haiku Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * The GNU/Linux xattr interface. Actual xattrs are identity-mapped into the
6  * Haiku attribute namespace with type B_XATTR_TYPE. Haiku attributes are mapped
7  * into a user xattr namespace, the attribute types encoded in the names.
8  */
9 #ifndef _GNU_SYS_CDEFS_H
10 #define _GNU_SYS_CDEFS_H
11 
12 
13 #include <sys/cdefs.h>
14 #include <sys/types.h>
15 
16 
17 /* constants for [l,f]setxattr() */
18 #define XATTR_CREATE	1	/* fail if attribute exists */
19 #define XATTR_REPLACE	2	/* fail if attribute doesn't exist yet */
20 
21 
22 __BEGIN_DECLS
23 
24 
25 ssize_t	getxattr(const char* path, const char* attribute, void* buffer,
26 			size_t size);
27 ssize_t	lgetxattr(const char* path, const char* attribute, void* buffer,
28 			size_t size);
29 ssize_t	fgetxattr(int fd, const char* attribute, void* buffer, size_t size);
30 
31 int		setxattr(const char* path, const char* attribute, const void* buffer,
32 			size_t size, int flags);
33 int		lsetxattr(const char* path, const char* attribute, const void* buffer,
34 			size_t size, int flags);
35 int		fsetxattr(int fd, const char* attribute, const void* buffer,
36 			size_t size, int flags);
37 
38 int		removexattr (const char* path, const char* attribute);
39 int		lremovexattr (const char* path, const char* attribute);
40 int		fremovexattr (int fd, const char* attribute);
41 
42 ssize_t	listxattr(const char* path, char* buffer, size_t size);
43 ssize_t	llistxattr(const char* path, char* buffer, size_t size);
44 ssize_t	flistxattr(int fd, char* buffer, size_t size);
45 
46 
47 __END_DECLS
48 
49 
50 #endif	/* _GNU_SYS_CDEFS_H */
51