mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-04-29 10:41:36 +00:00
use syscall numbers from Linux kernel headers
__NR_setns is defined in the Linux kernel headers in linux/unistd.h. The full Linux kernel sources are not necessary for compilation. Signed-off-by: David Ward <david.ward@ll.mit.edu> Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
This commit is contained in:
parent
ed55bf5203
commit
910bb4fa53
@ -1,76 +0,0 @@
|
||||
AC_DEFUN([AC_LINUX],
|
||||
[
|
||||
AC_LINUX_DIR()
|
||||
AC_LINUX_SRCARCH()
|
||||
])
|
||||
|
||||
AC_DEFUN([AS_TRY_LINUX_DIR],
|
||||
[AC_MSG_CHECKING(for Linux in $1)
|
||||
|
||||
if test -f "$1/Makefile" ; then
|
||||
result=yes
|
||||
$2
|
||||
else
|
||||
result="not found"
|
||||
$3
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT($result)
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_LINUX_DIR],
|
||||
[
|
||||
AC_ARG_WITH([linuxdir],
|
||||
[AC_HELP_STRING([--with-linuxdir=DIR],
|
||||
[specify path to Linux source directory])],
|
||||
[LINUX_DIR="${withval}"],
|
||||
[LINUX_DIR=default])
|
||||
|
||||
dnl if specified, use the specified one
|
||||
if test "${LINUX_DIR}" != "default" ; then
|
||||
AS_TRY_LINUX_DIR([${LINUX_DIR}], , AC_MSG_ERROR([Linux dir not found]) )
|
||||
fi
|
||||
|
||||
dnl if not specified, first try with previously set LINUX_KERNEL_RELEASE
|
||||
if test "${LINUX_DIR}" = "default" ; then
|
||||
dir="/lib/modules/$LINUX_KERNEL_RELEASE/build";
|
||||
AS_TRY_LINUX_DIR([${dir}], [LINUX_DIR=${dir}], )
|
||||
fi
|
||||
|
||||
dnl next try using the kernel source dir
|
||||
if test "${LINUX_DIR}" = "default" ; then
|
||||
dir="/usr/src/linux-$LINUX_KERNEL_RELEASE";
|
||||
AS_TRY_LINUX_DIR([${dir}], [LINUX_DIR=${dir}], )
|
||||
fi
|
||||
|
||||
dnl then try a common default of /usr/src/linux
|
||||
if test "${LINUX_DIR}" = "default" ; then
|
||||
dir="/usr/src/linux";
|
||||
AS_TRY_LINUX_DIR([${dir}], [LINUX_DIR=${dir}], )
|
||||
fi
|
||||
|
||||
dnl if still nothing found, fail
|
||||
if test "${LINUX_DIR}" = "default" ; then
|
||||
AC_MSG_WARN([Linux source directory not found])
|
||||
fi
|
||||
|
||||
AC_SUBST(LINUX_DIR)
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_LINUX_SRCARCH],[
|
||||
AC_MSG_CHECKING(for linux SRCARCH)
|
||||
|
||||
case "${host}" in
|
||||
i[[3456]]86-*) LINUX_SRCARCH=x86;;
|
||||
x86_64-*) LINUX_SRCARCH=x86;;
|
||||
powerpc*-*) LINUX_SRCARCH=powerpc;;
|
||||
s390*-*) LINUX_SRCARCH=s390;;
|
||||
arm*-*) LINUX_SRCARCH=arm;;
|
||||
mips*-*) LINUX_SRCARCH=mips;;
|
||||
sparc*-*) LINUX_SRCARCH=sparc;;
|
||||
*) AC_MSG_ERROR([architecture ${host} not supported]);;
|
||||
esac
|
||||
|
||||
AC_MSG_RESULT(${LINUX_SRCARCH})
|
||||
AC_SUBST(LINUX_SRCARCH)
|
||||
])
|
@ -65,13 +65,13 @@ AC_SUBST(LXCROOTFSMOUNT, "${with_rootfs_path}")
|
||||
AC_SUBST(LXCINITDIR, ['${libexecdir}/lxc'])
|
||||
AC_SUBST(LXCTEMPLATEDIR, ['${libdir}/lxc/templates'])
|
||||
|
||||
AC_CHECK_HEADERS([linux/netlink.h linux/genetlink.h],
|
||||
AC_CHECK_HEADERS([linux/unistd.h linux/netlink.h linux/genetlink.h],
|
||||
[],
|
||||
AC_MSG_ERROR([netlink headers not found. Please install the linux kernel headers.]),
|
||||
AC_MSG_ERROR([Please install the Linux kernel headers.]),
|
||||
[#include <sys/socket.h>
|
||||
])
|
||||
|
||||
AC_CHECK_HEADERS([sys/capability.h], [], AC_MSG_ERROR([please install libcap-devel.]),
|
||||
AC_CHECK_HEADERS([sys/capability.h], [], AC_MSG_ERROR([Please install the libcap development files.]),
|
||||
[#include <sys/types.h>
|
||||
#include <sys/capability.h>])
|
||||
AC_CHECK_LIB(cap,cap_set_proc,caplib=yes,caplib=no)
|
||||
@ -91,8 +91,6 @@ AC_CHECK_HEADERS([sys/signalfd.h])
|
||||
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
|
||||
AC_LINUX
|
||||
|
||||
if test "x$GCC" = "xyes"; then
|
||||
CFLAGS="$CFLAGS -Wall"
|
||||
fi
|
||||
|
@ -131,14 +131,3 @@ install-exec-local: install-soPROGRAMS
|
||||
|
||||
uninstall-local:
|
||||
$(RM) $(DESTDIR)$(libdir)/liblxc.so*
|
||||
|
||||
namespace.c: setns.h
|
||||
|
||||
setns.h:
|
||||
-$(CC) $(CPPFLAGS) -M -MT$@ $(LINUX_DIR)/arch/$(LINUX_SRCARCH)/include/asm/unistd.h >setns.P
|
||||
-$(CPP) $(CPPFLAGS) -dM $(LINUX_DIR)/arch/$(LINUX_SRCARCH)/include/asm/unistd.h |grep setns > $@
|
||||
|
||||
clean-local:
|
||||
$(RM) setns.h setns.P
|
||||
|
||||
-include setns.P
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/prctl.h>
|
||||
#include <linux/unistd.h>
|
||||
|
||||
#if !HAVE_DECL_PR_CAPBSET_DROP
|
||||
#define PR_CAPBSET_DROP 24
|
||||
@ -42,8 +43,6 @@
|
||||
#include "cgroup.h"
|
||||
#include "config.h"
|
||||
|
||||
#include "setns.h"
|
||||
|
||||
lxc_log_define(lxc_attach, lxc);
|
||||
|
||||
int setns(int fd, int nstype)
|
||||
|
Loading…
Reference in New Issue
Block a user