Check if dietlibc declares syscall incompatibly, to avoid errors.
authorDaniel Hokka Zakrisson <daniel@hozac.com>
Tue, 9 Jan 2007 13:22:11 +0000 (13:22 +0000)
committerDaniel Hokka Zakrisson <daniel@hozac.com>
Tue, 9 Jan 2007 13:22:11 +0000 (13:22 +0000)
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
lib/vserver-internal.h
lib_internal/sys_clone.h
lib_internal/sys_personality.h
m4/ensc_dietlibc.m4

index f46013c..3e48666 100644 (file)
@@ -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
index c8bf60f..6478e5d 100644 (file)
@@ -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
index d44269b..f30e8a2 100644 (file)
@@ -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);
index 5b5baee..422c5bc 100644 (file)
 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
index 9a55c51..bbbb031 100644 (file)
@@ -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 <sys/syscall.h>
+                       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(<conditional>[,<min-version>])
 dnl        <conditional> ... 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
 ])