[BusyBox-cvs] busybox.stable/libbb syscalls.c,1.7,1.8
Erik Andersen
andersen at busybox.net
Mon Nov 3 20:20:10 UTC 2003
Update of /var/cvs/busybox.stable/libbb
In directory winder:/tmp/cvs-serv18094/libbb
Modified Files:
syscalls.c
Log Message:
Accomodate both older and newer C libs
Index: syscalls.c
===================================================================
RCS file: /var/cvs/busybox.stable/libbb/syscalls.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- syscalls.c 12 Mar 2002 00:33:09 -0000 1.7
+++ syscalls.c 3 Nov 2003 20:20:05 -0000 1.8
@@ -34,13 +34,13 @@
#endif
#include "libbb.h"
-#if defined(__ia64__)
+#if __GNU_LIBRARY__ < 5
+_syscall3(int, sysfs, int, option, unsigned int, fs_index, char *, buf);
+#else
int sysfs( int option, unsigned int fs_index, char * buf)
{
return(syscall(__NR_sysfs, option, fs_index, buf));
}
-#else
-_syscall3(int, sysfs, int, option, unsigned int, fs_index, char *, buf);
#endif
#ifndef __NR_pivot_root
@@ -59,49 +59,70 @@
return -1;
}
#else
-# if defined(__ia64__)
+# if __GNU_LIBRARY__ < 5
+ _syscall2(int,pivot_root,const char *,new_root,const char *,put_old);
+# else
int pivot_root(const char * new_root,const char * put_old)
{
return(syscall(__NR_pivot_root, new_root, put_old));
}
-# else
- _syscall2(int,pivot_root,const char *,new_root,const char *,put_old);
# endif
#endif
-
+/* These syscalls are not included in ancient glibc versions */
#if __GNU_LIBRARY__ < 5 || ((__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1))
+
+
+#if __GNU_LIBRARY__ < 5
/* These syscalls are not included as part of libc5 */
_syscall2(int, bdflush, int, func, int, data);
+#else
+int bdflush(int func, int data)
+{
+ return(syscall(__NR_bdflush, func, data));
+}
+#endif
#ifndef __alpha__
+#if __GNU_LIBRARY__ < 5
# define __NR_klogctl __NR_syslog
- _syscall3(int, klogctl, int, type, char *, b, int, len);
+_syscall3(int, klogctl, int, type, char *, b, int, len);
+#else
+int klogctl(int type, char *b, int len)
+{
+ return(syscall(__NR_klogctl, type, b, len));
+}
+#endif
#endif
-#ifndef __NR_umount2
-# warning This kernel does not support the umount2 syscall
-# warning -> The umount2 system call is being stubbed out...
+
int umount2(const char * special_file, int flags)
{
- /* BusyBox was compiled against a kernel that did not support
- * the umount2 system call. To make this application work,
- * you will need to recompile with a kernel supporting the
- * umount2 system call.
- */
- fprintf(stderr, "\n\nTo make this application work, you will need to recompile\n");
- fprintf(stderr, "with a kernel supporting the umount2 system call. -Erik\n\n");
- errno=ENOSYS;
- return -1;
-}
-# else
-_syscall2(int, umount2, const char *, special_file, int, flags);
+#ifndef __NR_pivot_root
+#warning This kernel does not support the umount2 syscall
+#warning -> The umount2 system call is being stubbed out...
+ /* BusyBox was compiled against a kernel that did not support
+ * the umount2 system call. To make this application work,
+ * you will need to recompile with a kernel supporting the
+ * umount2 system call.
+ */
+ bb_error_msg("\n\nTo make this application work, you will need to recompile\n"
+ "BusyBox with a kernel supporting the umount2 system call.\n");
+ errno=ENOSYS;
+ return -1;
+#else
+# if __GNU_LIBRARY__ < 5
+ _syscall2(int, umount2, const char *, special_file, int, flags);
+# else
+ return(syscall(__NR_umount2, special_file, flags));
+# endif
#endif
+}
-#endif /* __GNU_LIBRARY__ < 5 */
+#endif /* __GNU_LIBRARY__ < 5 || ((__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1)) */
/* END CODE */
More information about the busybox-cvs
mailing list