From 4b6375a4a4408c6c9be252d46aa5a78cfcbb8617 Mon Sep 17 00:00:00 2001 From: WANG Chao Date: Tue, 22 Dec 2015 15:58:45 +0800 Subject: [PATCH] Use configure script to check setns function I happen to find out on centos6.7, glibc-headers does have SYS_setns defined, but previous release doesn't. It's better to use configure script to check setns function. Signed-off-by: WANG Chao --- configure.ac | 1 + src/syscall.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index efec743..d7e8a0f 100644 --- a/configure.ac +++ b/configure.ac @@ -32,6 +32,7 @@ AC_TYPE_UINT8_T # Checks for library functions. AC_FUNC_FORK AC_CHECK_FUNCS([dup2 memmove memset mkdir setenv socket strchr strdup strrchr strtoul], [fail=0], [fail=1]) +AC_CHECK_FUNCS([setns]) if test "$fail" = "1" ; then AC_MSG_ERROR(Unable to find necessary functions) diff --git a/src/syscall.h b/src/syscall.h index 4e33729..1ec8ff0 100644 --- a/src/syscall.h +++ b/src/syscall.h @@ -7,7 +7,7 @@ * requires kernel-headers for syscall number hint. */ -#if !defined SYS_setns && defined __NR_setns +#if !defined(HAVE_SETNS) && defined(__NR_setns) static inline int setns(int fd, int nstype) { errno = syscall(__NR_setns, fd, nstype);