[BusyBox-cvs] busybox.stable/libbb module_syscalls.c,1.8,1.9
Erik Andersen
andersen at busybox.net
Mon Nov 3 20:27:17 UTC 2003
Update of /var/cvs/busybox.stable/libbb
In directory winder:/tmp/cvs-serv18283/libbb
Modified Files:
module_syscalls.c
Log Message:
jump through hoops to make handle libc5 which must use _syscallN(),
while letting everything more modern use the syscall() function.
-Erik
Index: module_syscalls.c
===================================================================
RCS file: /var/cvs/busybox.stable/libbb/module_syscalls.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- module_syscalls.c 12 Mar 2002 00:33:09 -0000 1.8
+++ module_syscalls.c 3 Nov 2003 20:27:13 -0000 1.9
@@ -36,6 +36,8 @@
#if __GNU_LIBRARY__ < 5 || ((__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1))
+
+#if __GNU_LIBRARY__ < 5
/* These syscalls are not included as part of libc5 */
_syscall1(int, delete_module, const char *, name);
_syscall1(int, get_kernel_syms, __ptr_t, ks);
@@ -45,6 +47,24 @@
* and let the kernel cope with whatever it gets. Its good at that. */
_syscall5(int, init_module, void *, first, void *, second, void *, third,
void *, fourth, void *, fifth);
+#else
+int delete_module(const char *name)
+{
+ return(syscall(__NR_delete_module, name));
+}
+int get_kernel_syms(__ptr_t ks)
+{
+ return(syscall(__NR_get_kernel_syms, ks));
+}
+
+/* This may have 5 arguments (for old 2.0 kernels) or 2 arguments
+ * (for 2.2 and 2.4 kernels). Use the greatest common denominator,
+ * and let the kernel cope with whatever it gets. Its good at that. */
+int init_module(void *first, void *second, void *third, void *fourth, void *fifth)
+{
+ return(syscall(__NR_init_module, first, second, third, fourth, fifth));
+}
+#endif
#ifndef __NR_query_module
#warning This kernel does not support the query_module syscall
@@ -57,10 +77,15 @@
return -1;
}
#else
+# if __GNU_LIBRARY__ < 5
_syscall5(int, query_module, const char *, name, int, which,
void *, buf, size_t, bufsize, size_t*, ret);
+# else
+ return(syscall(__NR_query_module, name, which, buf, bufsize, ret));
+# endif
#endif
+# if __GNU_LIBRARY__ < 5
/* Jump through hoops to fixup error return codes */
#define __NR___create_module __NR_create_module
static inline _syscall2(long, __create_module, const char *, name, size_t, size)
@@ -74,6 +99,19 @@
}
return ret;
}
+#else
+/* Jump through hoops to fixup error return codes */
+unsigned long create_module(const char *name, size_t size)
+{
+ long ret = syscall(__NR_create_module, name, size);
+
+ if (ret == -1 && errno > 125) {
+ ret = -errno;
+ errno = 0;
+ }
+ return ret;
+}
+#endif
#endif /* __GNU_LIBRARY__ < 5 */
More information about the busybox-cvs
mailing list