From 94e52ff3c8a8360ab4394d79571785992283976c Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Tue, 9 Jan 2007 13:22:11 +0000 Subject: [PATCH] Check if dietlibc declares syscall incompatibly, to avoid errors. Move the syscall declaration to lib/syscall-wrap.h. git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2446 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- lib/syscall-wrap.h | 4 ++++ lib/vserver-internal.h | 4 ---- lib_internal/sys_clone.h | 3 --- lib_internal/sys_personality.h | 4 ---- m4/ensc_dietlibc.m4 | 27 +++++++++++++++++++++++++++ 5 files changed, 31 insertions(+), 11 deletions(-) diff --git a/lib/syscall-wrap.h b/lib/syscall-wrap.h index f46013c..3e48666 100644 --- a/lib/syscall-wrap.h +++ b/lib/syscall-wrap.h @@ -36,4 +36,8 @@ # include "syscall-alternative.h" #endif +#if defined(ENSC_SYSCALL_TRADITIONAL) && defined(__dietlibc__) && !defined(ENSC_DIETLIBC_HAS_SYSCALL) +extern long int syscall(long int __sysno, ...); +#endif + #endif // H_UTIL_VSERVER_LIB_SYSCALL_WRAP_H diff --git a/lib/vserver-internal.h b/lib/vserver-internal.h index c8bf60f..6478e5d 100644 --- a/lib/vserver-internal.h +++ b/lib/vserver-internal.h @@ -253,10 +253,6 @@ inline static ALWAYSINLINE void vc_noop0() {} inline static UNUSED ALWAYSINLINE int vserver(uint32_t cmd, uint32_t id, void *data) { -#if defined __dietlibc__ - extern long int syscall (long int __sysno, ...); -#endif - return syscall(__NR_vserver, cmd, id, data); } #else diff --git a/lib_internal/sys_clone.h b/lib_internal/sys_clone.h index d44269b..f30e8a2 100644 --- a/lib_internal/sys_clone.h +++ b/lib_internal/sys_clone.h @@ -42,9 +42,6 @@ int sys_clone(int flags, void *child_stack) #ifdef __sparc__ int parent = getpid(); #endif -#if defined(__dietlibc__) && defined(ENSC_SYSCALL_TRADITIONAL) - extern long int syscall (long int __sysno, ...); -#endif #if defined(__s390__) && defined(ENSC_SYSCALL_TRADITIONAL) ret = syscall(__NR__sys_clone, child_stack, flags); diff --git a/lib_internal/sys_personality.h b/lib_internal/sys_personality.h index 5b5baee..422c5bc 100644 --- a/lib_internal/sys_personality.h +++ b/lib_internal/sys_personality.h @@ -28,10 +28,6 @@ inline static UNUSED ALWAYSINLINE int sys_personality(int pers) { -#if defined __dietlibc__ - extern long int syscall (long int __sysno, ...); -#endif - return syscall(__NR_sys_personality, pers); } #else diff --git a/m4/ensc_dietlibc.m4 b/m4/ensc_dietlibc.m4 index 9a55c51..bbbb031 100644 --- a/m4/ensc_dietlibc.m4 +++ b/m4/ensc_dietlibc.m4 @@ -51,6 +51,32 @@ AC_DEFUN([_ENSC_DIETLIBC_C99], fi ]) +AC_DEFUN([_ENSC_DIETLIBC_SYSCALL], +[ + AH_TEMPLATE([ENSC_DIETLIBC_HAS_SYSCALL], [Define to 1 if dietlibc declares syscall]) + + AC_CACHE_CHECK([whether dietlibc declares syscall], [ensc_cv_c_dietlibc_syscall], + [ + _ensc_dietlibc_syscall_old_CC="$CC" + CC="${DIET:-diet} $CC" + + AC_LANG_PUSH(C) + AC_COMPILE_IFELSE([ + #include + long int syscall(long int __sysno, ...); + ], + [ensc_cv_c_dietlibc_syscall=no], + [ensc_cv_c_dietlibc_syscall=yes]) + AC_LANG_POP + + CC="$_ensc_dietlibc_syscall_old_CC" + ]) + + if test x"$ensc_cv_c_dietlibc_syscall" = xyes; then + AC_DEFINE(ENSC_DIETLIBC_HAS_SYSCALL,1) + fi +]) + dnl Usage: ENSC_ENABLE_DIETLIBC([,]) dnl ... automake-conditional which will be set when dnl dietlibc shall be enabled @@ -134,6 +160,7 @@ AC_DEFUN([ENSC_ENABLE_DIETLIBC], if test x"$ensc_have_dietlibc" != xno; then _ENSC_DIETLIBC_C99 + _ENSC_DIETLIBC_SYSCALL fi ]) -- 1.8.1.5