From e0b2bb0a47754d0887cecbb3f69f6f7bdcd1addb Mon Sep 17 00:00:00 2001 From: klondike Date: Mon, 19 Nov 2012 03:43:35 +0100 Subject: Check for unshare on the configure and provide an inline replacement when not available --- configure.ac | 10 ++++++++++ src/test/test-udev.c | 11 ++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 87385e406c..d609ef2604 100644 --- a/configure.ac +++ b/configure.ac @@ -187,6 +187,16 @@ fi AC_SUBST(ACL_LIBS) AM_CONDITIONAL([HAVE_ACL], [test "x$have_acl" != xno]) +# ------------------------------------------------------------------------------ + +AC_CHECK_DECL([unshare], + [AC_DEFINE(HAVE_UNSHARE, 1, [Define if unshare is declared])], + [AC_CHECK_DECL([SYS_unshare], + [ ] , + [AC_MSG_ERROR([*** unshare nor SYS_unshare found.])], + [#include ])], + [#include ]) + # ------------------------------------------------------------------------------ AC_ARG_WITH(firmware-path, AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]], diff --git a/src/test/test-udev.c b/src/test/test-udev.c index ff3bbbc8d3..8f2aee4a47 100644 --- a/src/test/test-udev.c +++ b/src/test/test-udev.c @@ -31,16 +31,13 @@ #include #include #include -#include #include "udev.h" -#ifndef SYS_unshare -#error "libc fails to set SYS_unshare: please file a bug report with eudev" -#endif - -#ifndef unshare -#define unshare(__X) syscall(SYS_unshare, __X) +#ifndef HAVE_UNSHARE +#include +/* Provide our own replacement with local reach*/ +static inline int unshare (int x) { return syscall(SYS_unshare, x); } #endif void udev_main_log(struct udev *udev, int priority, -- cgit v1.2.3-54-g00ecf