#include <sys/xattr.h>

sys/xattr.h

includes: sys/types.h
11 macros · 8 functions

macroXATTR_NOFOLLOW

Options for pathname based xattr calls
#define XATTR_NOFOLLOW 0x0001
Don't follow symbolic links

macroXATTR_CREATE

Options for setxattr calls
#define XATTR_CREATE 0x0002
set the value, fail if attr already exists

macroXATTR_REPLACE

#define XATTR_REPLACE 0x0004
set the value, fail if attr does not exist

macroXATTR_NOSECURITY

Set this to bypass authorization checking (eg. if doing auth-related work)
#define XATTR_NOSECURITY 0x0008

macroXATTR_NODEFAULT

Set this to bypass the default extended attribute file (dot-underscore file)
#define XATTR_NODEFAULT 0x0010

macroXATTR_SHOWCOMPRESSION

option for f/getxattr() and f/listxattr() to expose the HFS Compression extended attributes
#define XATTR_SHOWCOMPRESSION 0x0020

macroXATTR_NOFOLLOW_ANY

Options for pathname based xattr calls
#define XATTR_NOFOLLOW_ANY 0x0040
Don't follow any symbolic links in the path

macroXATTR_RESOLVE_BENEATH

#define XATTR_RESOLVE_BENEATH 0x0080
path must reside in the hierarchy beneath the starting directory

macroXATTR_MAXNAMELEN

#define XATTR_MAXNAMELEN 127

macroXATTR_FINDERINFO_NAME

See the ATTR_CMN_FNDRINFO section of getattrlist(2) for details on FinderInfo
#define XATTR_FINDERINFO_NAME "com.apple.FinderInfo"

macroXATTR_RESOURCEFORK_NAME

#define XATTR_RESOURCEFORK_NAME "com.apple.ResourceFork"

functiongetxattr

ssize_t getxattr(
	const char *path,
	const char *name,
	void *value,
	size_t size,
	u_int32_t position,
	int options
)
man page · Oct 19, 2004
getxattr(2) — get an extended attribute value

functionfgetxattr

ssize_t fgetxattr(
	int fd,
	const char *name,
	void *value,
	size_t size,
	u_int32_t position,
	int options
)
man page · Oct 19, 2004
fgetxattr(2) — get an extended attribute value

functionsetxattr

int setxattr(
	const char *path,
	const char *name,
	const void *value,
	size_t size,
	u_int32_t position,
	int options
)
man page · Oct 19, 2004
setxattr(2) — set an extended attribute value

functionfsetxattr

int fsetxattr(
	int fd,
	const char *name,
	const void *value,
	size_t size,
	u_int32_t position,
	int options
)
man page · Oct 19, 2004
fsetxattr(2) — set an extended attribute value

functionremovexattr

int removexattr(const char *path, const char *name, int options)
man page · Oct 19, 2004
removexattr(2) — remove an extended attribute value

functionfremovexattr

int fremovexattr(int fd, const char *name, int options)
man page · Oct 19, 2004
fremovexattr(2) — remove an extended attribute value

functionlistxattr

ssize_t listxattr(const char *path, char *namebuff, size_t size, int options)
man page · Oct 19, 2004
listxattr(2) — list extended attribute names

functionflistxattr

ssize_t flistxattr(int fd, char *namebuff, size_t size, int options)
man page · Oct 19, 2004
flistxattr(2) — list extended attribute names