#endif
-#if !defined(HAVE_GETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
+#if !defined(HAVE_XATTR_XATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
+
ssize_t rep_getxattr (const char *path, const char *name, void *value, size_t size);
#define getxattr(path, name, value, size) rep_getxattr(path, name, value, size)
/* define is in "replace.h" */
-#endif
-
-#if !defined(HAVE_FGETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
ssize_t rep_fgetxattr (int filedes, const char *name, void *value, size_t size);
#define fgetxattr(filedes, name, value, size) rep_fgetxattr(filedes, name, value, size)
/* define is in "replace.h" */
-#endif
-
-#if !defined(HAVE_LISTXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
ssize_t rep_listxattr (const char *path, char *list, size_t size);
#define listxattr(path, list, size) rep_listxattr(path, list, size)
/* define is in "replace.h" */
-#endif
-
-#if !defined(HAVE_FLISTXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
ssize_t rep_flistxattr (int filedes, char *list, size_t size);
#define flistxattr(filedes, value, size) rep_flistxattr(filedes, value, size)
/* define is in "replace.h" */
-#endif
-
-#if !defined(HAVE_REMOVEXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
int rep_removexattr (const char *path, const char *name);
#define removexattr(path, name) rep_removexattr(path, name)
/* define is in "replace.h" */
-#endif
-
-#if !defined(HAVE_FREMOVEXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
int rep_fremovexattr (int filedes, const char *name);
#define fremovexattr(filedes, name) rep_fremovexattr(filedes, name)
/* define is in "replace.h" */
-#endif
-
-#if !defined(HAVE_SETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
int rep_setxattr (const char *path, const char *name, const void *value, size_t size, int flags);
#define setxattr(path, name, value, size, flags) rep_setxattr(path, name, value, size, flags)
/* define is in "replace.h" */
-#endif
-
-#if !defined(HAVE_FSETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
int rep_fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags);
#define fsetxattr(filedes, name, value, size, flags) rep_fsetxattr(filedes, name, value, size, flags)
/* define is in "replace.h" */
-#endif
+
+#endif /* !defined(HAVE_XATTR_XATTR) || defined(XATTR_ADDITIONAL_OPTIONS) */
#endif
xattr_headers='sys/attributes.h attr/xattr.h sys/xattr.h'
- conf.CHECK_FUNCS_IN('''
-fgetxattr flistea flistxattr
-fremovexattr fsetxattr getxattr
-listxattr removexattr setxattr
-''', 'attr', checklibc=True, headers=xattr_headers)
-
- # We need to check for linux xattrs first, as we do not wish to link to -lattr
- # (the XFS compat API) on Linux systems with the native xattr API
- if not conf.CONFIG_SET('HAVE_GETXATTR'):
- conf.CHECK_FUNCS_IN('''
-attr_get attr_getf attr_list attr_listf attropen attr_remove
-attr_removef attr_set attr_setf extattr_delete_fd extattr_delete_file
-extattr_get_fd extattr_get_file extattr_list_fd extattr_list_file
-extattr_set_fd extattr_set_file fgetea
-fremoveea fsetea getea listea
-removeea setea
-''', 'attr', checklibc=True, headers=xattr_headers)
-
- if (conf.CONFIG_SET('HAVE_ATTR_LISTF') or
- conf.CONFIG_SET('HAVE_EXTATTR_LIST_FD') or
- conf.CONFIG_SET('HAVE_FLISTEA') or
- conf.CONFIG_SET('HAVE_FLISTXATTR')):
- conf.DEFINE('HAVE_XATTR_SUPPORT', 1)
-
- # Darwin has extra options to xattr-family functions
- conf.CHECK_CODE('getxattr(NULL, NULL, NULL, 0, 0, 0)',
- headers=xattr_headers, local_include=False,
- define='XATTR_ADDITIONAL_OPTIONS',
- msg="Checking whether xattr interface takes additional options")
+ # default to 1, we set it to 0 if we don't find any EA implementation below:
+ conf.DEFINE('HAVE_XATTR_SUPPORT', 1)
+ if conf.CHECK_FUNCS_IN('getxattr', 'attr', checklibc=True, headers=xattr_headers):
+ conf.DEFINE('HAVE_XATTR_XATTR', 1)
+ # Darwin has extra options to xattr-family functions
+ conf.CHECK_CODE('getxattr(NULL, NULL, NULL, 0, 0, 0)',
+ headers=xattr_headers, local_include=False,
+ define='XATTR_ADDITIONAL_OPTIONS',
+ msg="Checking whether xattr interface takes additional options")
+ elif conf.CHECK_FUNCS_IN('attr_listf', 'attr', checklibc=True, headers=xattr_headers):
+ conf.DEFINE('HAVE_XATTR_ATTR', 1)
+ elif conf.CHECK_FUNCS('extattr_list_fd'):
+ conf.DEFINE('HAVE_XATTR_EXTATTR', 1)
+ elif conf.CHECK_FUNCS('flistea'):
+ conf.DEFINE('HAVE_XATTR_EA', 1)
+ elif not conf.CHECK_FUNCS('attropen'):
+ conf.DEFINE('HAVE_XATTR_SUPPORT', 0)
+
conf.CHECK_FUNCS_IN('dlopen dlsym dlerror dlclose', 'dl',
checklibc=True, headers='dlfcn.h dl.h')
ssize_t rep_getxattr (const char *path, const char *name, void *value, size_t size)
{
-#if defined(HAVE_GETXATTR)
+#if defined(HAVE_XATTR_XATTR)
#ifndef XATTR_ADDITIONAL_OPTIONS
return getxattr(path, name, value, size);
#else
int options = 0;
return getxattr(path, name, value, size, 0, options);
#endif
-#elif defined(HAVE_GETEA)
+#elif defined(HAVE_XATTR_EA)
return getea(path, name, value, size);
-#elif defined(HAVE_EXTATTR_GET_FILE)
+#elif defined(HAVE_XATTR_EXTATTR)
ssize_t retval;
int attrnamespace;
const char *attrname;
}
return -1;
-#elif defined(HAVE_ATTR_GET)
+#elif defined(HAVE_XATTR_ATTR)
int retval, flags = 0;
int valuelength = (int)size;
char *attrname = strchr(name,'.') + 1;
ssize_t rep_fgetxattr (int filedes, const char *name, void *value, size_t size)
{
-#if defined(HAVE_FGETXATTR)
+#if defined(HAVE_XATTR_XATTR)
#ifndef XATTR_ADDITIONAL_OPTIONS
return fgetxattr(filedes, name, value, size);
#else
int options = 0;
return fgetxattr(filedes, name, value, size, 0, options);
#endif
-#elif defined(HAVE_FGETEA)
+#elif defined(HAVE_XATTR_EA)
return fgetea(filedes, name, value, size);
-#elif defined(HAVE_EXTATTR_GET_FD)
+#elif defined(HAVE_XATTR_EXTATTR)
ssize_t retval;
int attrnamespace;
const char *attrname;
}
return -1;
-#elif defined(HAVE_ATTR_GETF)
+#elif defined(HAVE_XATTR_ATTR)
int retval, flags = 0;
int valuelength = (int)size;
char *attrname = strchr(name,'.') + 1;
#endif
}
-#if defined(HAVE_EXTATTR_LIST_FILE)
+#if defined(HAVE_XATTR_EXTATTR)
#define EXTATTR_PREFIX(s) (s), (sizeof((s))-1)
continue;
}
switch(type) {
-#if defined(HAVE_EXTATTR_LIST_FILE)
case 0:
list_size = extattr_list_file(arg.path, extattr[t].space, list, size);
break;
-#endif
-#if defined(HAVE_EXTATTR_LIST_LINK)
case 1:
list_size = extattr_list_link(arg.path, extattr[t].space, list, size);
break;
-#endif
-#if defined(HAVE_EXTATTR_LIST_FD)
case 2:
list_size = extattr_list_fd(arg.filedes, extattr[t].space, list, size);
break;
-#endif
default:
errno = ENOSYS;
return -1;
#endif
-#if defined(HAVE_ATTR_LIST) && (defined(HAVE_SYS_ATTRIBUTES_H) || defined(HAVE_ATTR_ATTRIBUTES_H))
+#if defined(HAVE_XATTR_ATTR) && (defined(HAVE_SYS_ATTRIBUTES_H) || defined(HAVE_ATTR_ATTRIBUTES_H))
static char attr_buffer[ATTR_MAX_VALUELEN];
static ssize_t irix_attr_list(const char *path, int filedes, char *list, size_t size, int flags)
ssize_t rep_listxattr (const char *path, char *list, size_t size)
{
-#if defined(HAVE_LISTXATTR)
+#if defined(HAVE_XATTR_XATTR)
#ifndef XATTR_ADDITIONAL_OPTIONS
return listxattr(path, list, size);
#else
int options = 0;
return listxattr(path, list, size, options);
#endif
-#elif defined(HAVE_LISTEA)
+#elif defined(HAVE_XATTR_EA)
return listea(path, list, size);
-#elif defined(HAVE_EXTATTR_LIST_FILE)
+#elif defined(HAVE_XATTR_EXTATTR)
extattr_arg arg;
arg.path = path;
return bsd_attr_list(0, arg, list, size);
-#elif defined(HAVE_ATTR_LIST) && defined(HAVE_SYS_ATTRIBUTES_H)
+#elif defined(HAVE_XATTR_ATTR) && defined(HAVE_SYS_ATTRIBUTES_H)
return irix_attr_list(path, 0, list, size, 0);
#elif defined(HAVE_ATTROPEN)
ssize_t ret = -1;
ssize_t rep_flistxattr (int filedes, char *list, size_t size)
{
-#if defined(HAVE_FLISTXATTR)
+#if defined(HAVE_XATTR_XATTR)
#ifndef XATTR_ADDITIONAL_OPTIONS
return flistxattr(filedes, list, size);
#else
int options = 0;
return flistxattr(filedes, list, size, options);
#endif
-#elif defined(HAVE_FLISTEA)
+#elif defined(HAVE_XATTR_EA)
return flistea(filedes, list, size);
-#elif defined(HAVE_EXTATTR_LIST_FD)
+#elif defined(HAVE_XATTR_EXTATTR)
extattr_arg arg;
arg.filedes = filedes;
return bsd_attr_list(2, arg, list, size);
-#elif defined(HAVE_ATTR_LISTF)
+#elif defined(HAVE_XATTR_ATTR)
return irix_attr_list(NULL, filedes, list, size, 0);
#elif defined(HAVE_ATTROPEN)
ssize_t ret = -1;
int rep_removexattr (const char *path, const char *name)
{
-#if defined(HAVE_REMOVEXATTR)
+#if defined(HAVE_XATTR_XATTR)
#ifndef XATTR_ADDITIONAL_OPTIONS
return removexattr(path, name);
#else
int options = 0;
return removexattr(path, name, options);
#endif
-#elif defined(HAVE_REMOVEEA)
+#elif defined(HAVE_XATTR_EA)
return removeea(path, name);
-#elif defined(HAVE_EXTATTR_DELETE_FILE)
+#elif defined(HAVE_XATTR_EXTATTR)
int attrnamespace;
const char *attrname;
}
return extattr_delete_file(path, attrnamespace, attrname);
-#elif defined(HAVE_ATTR_REMOVE)
+#elif defined(HAVE_XATTR_ATTR)
int flags = 0;
char *attrname = strchr(name,'.') + 1;
int rep_fremovexattr (int filedes, const char *name)
{
-#if defined(HAVE_FREMOVEXATTR)
+#if defined(HAVE_XATTR_XATTR)
#ifndef XATTR_ADDITIONAL_OPTIONS
return fremovexattr(filedes, name);
#else
int options = 0;
return fremovexattr(filedes, name, options);
#endif
-#elif defined(HAVE_FREMOVEEA)
+#elif defined(HAVE_XATTR_EA)
return fremoveea(filedes, name);
-#elif defined(HAVE_EXTATTR_DELETE_FD)
+#elif defined(HAVE_XATTR_EXTATTR)
int attrnamespace;
const char *attrname;
}
return extattr_delete_fd(filedes, attrnamespace, attrname);
-#elif defined(HAVE_ATTR_REMOVEF)
+#elif defined(HAVE_XATTR_ATTR)
int flags = 0;
char *attrname = strchr(name,'.') + 1;
int rep_setxattr (const char *path, const char *name, const void *value, size_t size, int flags)
{
-#if defined(HAVE_SETXATTR)
+#if defined(HAVE_XATTR_XATTR)
#ifndef XATTR_ADDITIONAL_OPTIONS
return setxattr(path, name, value, size, flags);
#else
int options = 0;
return setxattr(path, name, value, size, 0, options);
#endif
-#elif defined(HAVE_SETEA)
+#elif defined(HAVE_XATTR_EA)
return setea(path, name, value, size, flags);
-#elif defined(HAVE_EXTATTR_SET_FILE)
+#elif defined(HAVE_XATTR_EXTATTR)
int retval = 0;
int attrnamespace;
const char *attrname;
}
retval = extattr_set_file(path, attrnamespace, attrname, value, size);
return (retval < 0) ? -1 : 0;
-#elif defined(HAVE_ATTR_SET)
+#elif defined(HAVE_XATTR_ATTR)
int myflags = 0;
char *attrname = strchr(name,'.') + 1;
int rep_fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags)
{
-#if defined(HAVE_FSETXATTR)
+#if defined(HAVE_XATTR_XATTR)
#ifndef XATTR_ADDITIONAL_OPTIONS
return fsetxattr(filedes, name, value, size, flags);
#else
int options = 0;
return fsetxattr(filedes, name, value, size, 0, options);
#endif
-#elif defined(HAVE_FSETEA)
+#elif defined(HAVE_XATTR_EA)
return fsetea(filedes, name, value, size, flags);
-#elif defined(HAVE_EXTATTR_SET_FD)
+#elif defined(HAVE_XATTR_EXTATTR)
int retval = 0;
int attrnamespace;
const char *attrname;
}
retval = extattr_set_fd(filedes, attrnamespace, attrname, value, size);
return (retval < 0) ? -1 : 0;
-#elif defined(HAVE_ATTR_SETF)
+#elif defined(HAVE_XATTR_ATTR)
int myflags = 0;
char *attrname = strchr(name,'.') + 1;