summaryrefslogtreecommitdiff
path: root/lib/replace
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-06-01 15:01:09 +1000
committerAndrew Bartlett <abartlet@samba.org>2012-06-02 02:13:49 +0200
commite9d797e153ae95561dbb10b56a41281b2472f137 (patch)
tree1a79b7c8d08352f7a9ead4c15b5c46d2a7f6aeaa /lib/replace
parentf9b7cd53b9fe253b122cb545c2dd1be073ab0592 (diff)
downloadsamba-e9d797e153ae95561dbb10b56a41281b2472f137.tar.gz
samba-e9d797e153ae95561dbb10b56a41281b2472f137.tar.bz2
samba-e9d797e153ae95561dbb10b56a41281b2472f137.zip
lib/replace: Merge remaining xattr test details from lib/util
I prefer the longer XATTR_ADDITIONAL_OPTIONS define and the NULL rather than 0 values in the getxattr test. Andrew Bartlett
Diffstat (limited to 'lib/replace')
-rw-r--r--lib/replace/libreplace.m44
-rw-r--r--lib/replace/replace.h16
-rw-r--r--lib/replace/system/filesys.h16
-rw-r--r--lib/replace/wscript14
-rw-r--r--lib/replace/xattr.c16
5 files changed, 34 insertions, 32 deletions
diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4
index 8176a000b3..641d25bb52 100644
--- a/lib/replace/libreplace.m4
+++ b/lib/replace/libreplace.m4
@@ -181,13 +181,13 @@ if test x"$ac_cv_func_getxattr" = x"yes" ; then
#include <sys/xattr.h>
#endif
],[
- getxattr(0, 0, 0, 0, 0, 0);
+ getxattr(NULL, NULL, NULL, 0, 0, 0);
],
[smb_attr_cv_xattr_add_opt=yes],
[smb_attr_cv_xattr_add_opt=no;LIBS=$old_LIBS])
])
if test x"$smb_attr_cv_xattr_add_opt" = x"yes"; then
- AC_DEFINE(XATTR_ADD_OPT, 1, [xattr functions have additional options])
+ AC_DEFINE(XATTR_ADDITIONAL_OPTIONS, 1, [xattr functions have additional options])
fi
fi
diff --git a/lib/replace/replace.h b/lib/replace/replace.h
index fe3ef3dcfd..218303f296 100644
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -543,42 +543,42 @@ ssize_t rep_pwrite(int __fd, const void *__buf, size_t __nbytes, off_t __offset)
/* prototype is in "system/network.h" */
#endif
-#if !defined(HAVE_GETXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_GETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
#define getxattr rep_getxattr
/* prototype is in "system/filesys.h" */
#endif
-#if !defined(HAVE_FGETXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_FGETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
#define fgetxattr rep_fgetxattr
/* prototype is in "system/filesys.h" */
#endif
-#if !defined(HAVE_LISTXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_LISTXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
#define listxattr rep_listxattr
/* prototype is in "system/filesys.h" */
#endif
-#if !defined(HAVE_FLISTXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_FLISTXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
#define flistxattr rep_flistxattr
/* prototype is in "system/filesys.h" */
#endif
-#if !defined(HAVE_REMOVEXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_REMOVEXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
#define removexattr rep_removexattr
/* prototype is in "system/filesys.h" */
#endif
-#if !defined(HAVE_FREMOVEXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_FREMOVEXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
#define fremovexattr rep_fremovexattr
/* prototype is in "system/filesys.h" */
#endif
-#if !defined(HAVE_SETXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_SETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
#define setxattr rep_setxattr
/* prototype is in "system/filesys.h" */
#endif
-#if !defined(HAVE_FSETXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_FSETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
#define fsetxattr rep_fsetxattr
/* prototype is in "system/filesys.h" */
#endif
diff --git a/lib/replace/system/filesys.h b/lib/replace/system/filesys.h
index cf8b36b53f..a72a59a31a 100644
--- a/lib/replace/system/filesys.h
+++ b/lib/replace/system/filesys.h
@@ -224,42 +224,42 @@
#endif
-#if !defined(HAVE_GETXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_GETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
ssize_t rep_getxattr (const char *path, const char *name, void *value, size_t size);
/* define is in "replace.h" */
#endif
-#if !defined(HAVE_FGETXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_FGETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
ssize_t rep_fgetxattr (int filedes, const char *name, void *value, size_t size);
/* define is in "replace.h" */
#endif
-#if !defined(HAVE_LISTXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_LISTXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
ssize_t rep_listxattr (const char *path, char *list, size_t size);
/* define is in "replace.h" */
#endif
-#if !defined(HAVE_FLISTXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_FLISTXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
ssize_t rep_flistxattr (int filedes, char *list, size_t size);
/* define is in "replace.h" */
#endif
-#if !defined(HAVE_REMOVEXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_REMOVEXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
int rep_removexattr (const char *path, const char *name);
/* define is in "replace.h" */
#endif
-#if !defined(HAVE_FREMOVEXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_FREMOVEXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
int rep_fremovexattr (int filedes, const char *name);
/* define is in "replace.h" */
#endif
-#if !defined(HAVE_SETXATTR) || defined(XATTR_ADD_OPT)
+#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 is in "replace.h" */
#endif
-#if !defined(HAVE_FSETXATTR) || defined(XATTR_ADD_OPT)
+#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 is in "replace.h" */
#endif
diff --git a/lib/replace/wscript b/lib/replace/wscript
index 1d1480caec..6331b884ed 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -213,11 +213,13 @@ def configure(conf):
conf.SET_TARGET_TYPE('attr', 'EMPTY')
+ 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)
+''', '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
@@ -229,7 +231,7 @@ extattr_get_fd extattr_get_file extattr_list_fd extattr_list_file
extattr_set_fd extattr_set_file fgetea flistea
fremoveea fsetea getea listea
removeea setea
-''', 'attr', checklibc=True)
+''', 'attr', checklibc=True, headers=xattr_headers)
if (conf.CONFIG_SET('HAVE_ATTR_LISTF') or
conf.CONFIG_SET('HAVE_EXTATTR_LIST_FD') or
@@ -238,10 +240,10 @@ removeea setea
conf.DEFINE('HAVE_XATTR_SUPPORT', 1)
# Darwin has extra options to xattr-family functions
- conf.CHECK_CODE('getxattr(0, 0, 0, 0, 0, 0);',
- 'XATTR_ADD_OPT',
- msg="Checking whether xattr interface takes additional options",
- headers='sys/types.h attr/xattr.h sys/xattr.h')
+ 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")
conf.CHECK_FUNCS_IN('dlopen dlsym dlerror dlclose', 'dl',
checklibc=True, headers='dlfcn.h dl.h')
diff --git a/lib/replace/xattr.c b/lib/replace/xattr.c
index 192784f344..39f55c66b2 100644
--- a/lib/replace/xattr.c
+++ b/lib/replace/xattr.c
@@ -42,7 +42,7 @@ static int solaris_openat(int fildes, const char *path, int oflag, mode_t mode);
ssize_t rep_getxattr (const char *path, const char *name, void *value, size_t size)
{
#if defined(HAVE_GETXATTR)
-#ifndef XATTR_ADD_OPT
+#ifndef XATTR_ADDITIONAL_OPTIONS
return getxattr(path, name, value, size);
#else
int options = 0;
@@ -98,7 +98,7 @@ ssize_t rep_getxattr (const char *path, const char *name, void *value, size_t si
ssize_t rep_fgetxattr (int filedes, const char *name, void *value, size_t size)
{
#if defined(HAVE_FGETXATTR)
-#ifndef XATTR_ADD_OPT
+#ifndef XATTR_ADDITIONAL_OPTIONS
return fgetxattr(filedes, name, value, size);
#else
int options = 0;
@@ -311,7 +311,7 @@ static ssize_t irix_attr_list(const char *path, int filedes, char *list, size_t
ssize_t rep_listxattr (const char *path, char *list, size_t size)
{
#if defined(HAVE_LISTXATTR)
-#ifndef XATTR_ADD_OPT
+#ifndef XATTR_ADDITIONAL_OPTIONS
return listxattr(path, list, size);
#else
int options = 0;
@@ -342,7 +342,7 @@ ssize_t rep_listxattr (const char *path, char *list, size_t size)
ssize_t rep_flistxattr (int filedes, char *list, size_t size)
{
#if defined(HAVE_FLISTXATTR)
-#ifndef XATTR_ADD_OPT
+#ifndef XATTR_ADDITIONAL_OPTIONS
return flistxattr(filedes, list, size);
#else
int options = 0;
@@ -373,7 +373,7 @@ ssize_t rep_flistxattr (int filedes, char *list, size_t size)
int rep_removexattr (const char *path, const char *name)
{
#if defined(HAVE_REMOVEXATTR)
-#ifndef XATTR_ADD_OPT
+#ifndef XATTR_ADDITIONAL_OPTIONS
return removexattr(path, name);
#else
int options = 0;
@@ -412,7 +412,7 @@ int rep_removexattr (const char *path, const char *name)
int rep_fremovexattr (int filedes, const char *name)
{
#if defined(HAVE_FREMOVEXATTR)
-#ifndef XATTR_ADD_OPT
+#ifndef XATTR_ADDITIONAL_OPTIONS
return fremovexattr(filedes, name);
#else
int options = 0;
@@ -451,7 +451,7 @@ int rep_fremovexattr (int filedes, const char *name)
int rep_setxattr (const char *path, const char *name, const void *value, size_t size, int flags)
{
#if defined(HAVE_SETXATTR)
-#ifndef XATTR_ADD_OPT
+#ifndef XATTR_ADDITIONAL_OPTIONS
return setxattr(path, name, value, size, flags);
#else
int options = 0;
@@ -516,7 +516,7 @@ int rep_setxattr (const char *path, const char *name, const void *value, size_t
int rep_fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags)
{
#if defined(HAVE_FSETXATTR)
-#ifndef XATTR_ADD_OPT
+#ifndef XATTR_ADDITIONAL_OPTIONS
return fsetxattr(filedes, name, value, size, flags);
#else
int options = 0;