aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-02-13 08:09:43 +0000
committerEric Andersen <andersen@codepoet.org>2004-02-13 08:09:43 +0000
commitec359e9ebbd1e55e4e3074512f8a5b191c3465a3 (patch)
treef995d6a7262324701a9b13db51d8eb263b8b40be /libbb
parent95b26250a773966ad16a6fa241154abc3414776c (diff)
downloadbusybox-ec359e9ebbd1e55e4e3074512f8a5b191c3465a3.tar.gz
Accomodate the fact that newer libc versions may in fact not
contain query_module and friends and more
Diffstat (limited to 'libbb')
-rw-r--r--libbb/module_syscalls.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/libbb/module_syscalls.c b/libbb/module_syscalls.c
index cb9258af2..9dca6f04f 100644
--- a/libbb/module_syscalls.c
+++ b/libbb/module_syscalls.c
@@ -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 @@ int get_kernel_syms(__ptr_t ks)
* 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 @@ int query_module(const char *name, int which, void *buf, size_t bufsize, size_t
/* 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 @@ unsigned long create_module(const char *name, size_t size)
errno = 0;
}
return ret;
-}
-
#endif
+}
/* END CODE */