[Buildroot] [PATCH 1/1] util-linux: Add an option to compile 'nsenter' binary.

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Fri Dec 26 20:57:30 UTC 2014


Dear Nicolas Cavallari,

On Fri, 26 Dec 2014 21:45:42 +0100, Nicolas Cavallari wrote:

> I'm not so sure now ... The fallback uses SYS_netns, instead of the
> kernel's __NR_setns, so i assume that there must be some C library
> support ... uclibc does define SYS_netns to be __NR_setns, so i think
> the problem is still valid if the toolchain does not define SYS_setns.

I was also confused by this, but it's actually util-linux itself that
defines SYS_setns from __NR_setns.

From m4/ul.m4 in util-linux sources:

AC_DEFUN([UL_CHECK_SYSCALL], [
  dnl This macro uses host_cpu.
  AC_REQUIRE([AC_CANONICAL_HOST])
  AC_CACHE_CHECK([for syscall $1],
    [ul_cv_syscall_$1],
    [_UL_SYSCALL_CHECK_DECL([SYS_$1],
      [syscall=SYS_$1],
      [dnl Our libc failed use, so see if we can get the kernel
      dnl headers to play ball ...
      _UL_SYSCALL_CHECK_DECL([_NR_$1],
        [syscall=_NR_$1],
        [
          syscall=no
          if test "x$linux_os" = xyes; then
            case $host_cpu in
              _UL_CHECK_SYSCALL_FALLBACK(m4_shift($@))
            esac
          fi
        ])
      ])
    ul_cv_syscall_$1=$syscall
    ])
  AM_CONDITIONAL([HAVE_]m4_toupper($1), [test "x$ul_cv_syscall_$1" != xno])
  case $ul_cv_syscall_$1 in #(
  no) AC_MSG_WARN([Unable to detect syscall $1.]) ;;
  SYS_*) ;;
  *) AC_DEFINE_UNQUOTED([SYS_$1], [$ul_cv_syscall_$1],
        [Fallback syscall number for $1]) ;;
  esac
])

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com



More information about the buildroot mailing list