[BusyBox-cvs] busybox/libbb module_syscalls.c,1.13,1.14

Erik Andersen andersen at busybox.net
Fri Feb 13 08:09:46 UTC 2004


Update of /var/cvs/busybox/libbb
In directory nail:/tmp/cvs-serv10570/libbb

Modified Files:
	module_syscalls.c 
Log Message:
Accomodate the fact that newer libc versions may in fact not
contain query_module and friends and more


Index: module_syscalls.c
===================================================================
RCS file: /var/cvs/busybox/libbb/module_syscalls.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- module_syscalls.c	22 Jul 2003 08:56:46 -0000	1.13
+++ module_syscalls.c	13 Feb 2004 08:09:43 -0000	1.14
@@ -23,22 +23,33 @@
 #include <stdio.h>
 #include <errno.h>
 #include <unistd.h>
-/* Kernel headers before 2.1.mumble need this on the Alpha to get
-   _syscall* defined.  */
-#define __LIBRARY__
 #include <sys/syscall.h>
 #include "libbb.h"
 
 
 /* These syscalls are not included in very old glibc versions */
-#if ((__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1))
 int delete_module(const char *name)
 {
+#ifndef __NR_delete_module
+#warning This kernel does not support the delete_module syscall
+#warning -> The delete_module system call is being stubbed out...
+    errno=ENOSYS;
+    return -1;
+#else
     return(syscall(__NR_delete_module, name));
+#endif
 }
+
 int get_kernel_syms(__ptr_t ks)
 {
+#ifndef __NR_get_kernel_syms
+#warning This kernel does not support the get_kernel_syms syscall
+#warning -> The get_kernel_syms system call is being stubbed out...
+    errno=ENOSYS;
+    return -1;
+#else
     return(syscall(__NR_get_kernel_syms, ks));
+#endif
 }
 
 /* This may have 5 arguments (for old 2.0 kernels) or 2 arguments
@@ -46,7 +57,14 @@
  * 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)
 {
+#ifndef __NR_init_module
+#warning This kernel does not support the init_module syscall
+#warning -> The init_module system call is being stubbed out...
+    errno=ENOSYS;
+    return -1;
+#else
     return(syscall(__NR_init_module, first, second, third, fourth, fifth));
+#endif
 }
 
 int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret)
@@ -66,6 +84,12 @@
 /* Jump through hoops to fixup error return codes */
 unsigned long create_module(const char *name, size_t size)
 {
+#ifndef __NR_create_module
+#warning This kernel does not support the create_module syscall
+#warning -> The create_module system call is being stubbed out...
+    errno=ENOSYS;
+    return -1;
+#else
     long ret = syscall(__NR_create_module, name, size);
 
     if (ret == -1 && errno > 125) {
@@ -73,9 +97,8 @@
 	errno = 0;
     }
     return ret;
-}
-
 #endif
+}
 
 
 /* END CODE */




More information about the busybox-cvs mailing list