[systemd-commits] 2 commits - configure.ac src/shared

Lennart Poettering lennart at kemper.freedesktop.org
Thu Feb 20 18:08:08 PST 2014


 configure.ac         |    5 +++--
 src/shared/missing.h |   41 +++++++++++++++++++++++++----------------
 2 files changed, 28 insertions(+), 18 deletions(-)

New commits:
commit 6633045578722be838ba5e40632379f79e5f4954
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Feb 21 03:07:42 2014 +0100

    missing: simplifications

diff --git a/src/shared/missing.h b/src/shared/missing.h
index 3142306..06c69da 100644
--- a/src/shared/missing.h
+++ b/src/shared/missing.h
@@ -273,25 +273,17 @@ static inline pid_t gettid(void) {
 #define MAX_HANDLE_SZ 128
 #endif
 
-#if defined __x86_64__
-#  ifndef __NR_name_to_handle_at
+#ifndef __NR_name_to_handle_at
+#  if defined(__x86_64__)
 #    define __NR_name_to_handle_at 303
-#  endif
-#elif defined __i386__
-#  ifndef __NR_name_to_handle_at
+#  elif defined(__i386__)
 #    define __NR_name_to_handle_at 341
-#  endif
-#elif defined __arm__
-#  ifndef __NR_name_to_handle_at
+#  elif defined(__arm__)
 #    define __NR_name_to_handle_at 370
-#  endif
-#elif defined __powerpc__
-#  ifndef __NR_name_to_handle_at
+#  elif defined(__powerpc__)
 #    define __NR_name_to_handle_at 345
-#  endif
-#else
-#  ifndef __NR_name_to_handle_at
-#    error __NR_name_to_handle_at is not defined
+#  else
+#    error "__NR_name_to_handle_at is not defined"
 #  endif
 #endif
 
@@ -311,7 +303,7 @@ static inline int name_to_handle_at(int fd, const char *name, struct file_handle
 #  ifdef HAVE___SECURE_GETENV
 #    define secure_getenv __secure_getenv
 #  else
-#    error neither secure_getenv nor __secure_getenv are available
+#    error "neither secure_getenv nor __secure_getenv are available"
 #  endif
 #endif
 

commit 3b794314149e40afaf3c456285e1e529747b6560
Author: Holger Schurig <holgerschurig at gmail.com>
Date:   Thu Feb 20 14:39:13 2014 +0100

    build-sys: Add setns() functions if not in the C library.
    
    Debian Stable is still using glibc 2.13, which doesn't provide the setns().
    So we detect this and provide a tiny wrapper that issues the setns syscall
    towards the kernel.

diff --git a/configure.ac b/configure.ac
index 05ee098..18df6d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -241,10 +241,11 @@ LIBS="$save_LIBS"
 
 AC_CHECK_FUNCS([fanotify_init fanotify_mark])
 AC_CHECK_FUNCS([__secure_getenv secure_getenv])
-AC_CHECK_DECLS([gettid, pivot_root, name_to_handle_at], [], [], [[#include <sys/types.h>
+AC_CHECK_DECLS([gettid, pivot_root, name_to_handle_at, setns], [], [], [[#include <sys/types.h>
 #include <unistd.h>
 #include <sys/mount.h>
-#include <fcntl.h>]])
+#include <fcntl.h>
+#include <sched.h>]])
 
 # This makes sure pkg.m4 is available.
 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
diff --git a/src/shared/missing.h b/src/shared/missing.h
index 2661285..3142306 100644
--- a/src/shared/missing.h
+++ b/src/shared/missing.h
@@ -28,6 +28,7 @@
 #include <fcntl.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <errno.h>
 #include <linux/oom.h>
 #include <linux/input.h>
 #include <linux/if_link.h>
@@ -353,3 +354,19 @@ static inline int name_to_handle_at(int fd, const char *name, struct file_handle
 #endif
 
 #endif
+
+#ifndef __NR_setns
+#  if defined(__x86_64__)
+#    define __NR_setns 308
+#  elif defined(__i386__)
+#    define __NR_setns 346
+#  else
+#    error "__NR_setns is not defined"
+#  endif
+#endif
+
+#if !HAVE_DECL_SETNS
+static inline int setns(int fd, int nstype) {
+        return syscall(__NR_setns, fd, nstype);
+}
+#endif



More information about the systemd-commits mailing list