aboutsummaryrefslogtreecommitdiff
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
parent95b26250a773966ad16a6fa241154abc3414776c (diff)
downloadbusybox-w32-ec359e9ebbd1e55e4e3074512f8a5b191c3465a3.tar.gz
busybox-w32-ec359e9ebbd1e55e4e3074512f8a5b191c3465a3.tar.bz2
busybox-w32-ec359e9ebbd1e55e4e3074512f8a5b191c3465a3.zip
Accomodate the fact that newer libc versions may in fact not
contain query_module and friends and more
-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 @@
23#include <stdio.h> 23#include <stdio.h>
24#include <errno.h> 24#include <errno.h>
25#include <unistd.h> 25#include <unistd.h>
26/* Kernel headers before 2.1.mumble need this on the Alpha to get
27 _syscall* defined. */
28#define __LIBRARY__
29#include <sys/syscall.h> 26#include <sys/syscall.h>
30#include "libbb.h" 27#include "libbb.h"
31 28
32 29
33/* These syscalls are not included in very old glibc versions */ 30/* These syscalls are not included in very old glibc versions */
34#if ((__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1))
35int delete_module(const char *name) 31int delete_module(const char *name)
36{ 32{
33#ifndef __NR_delete_module
34#warning This kernel does not support the delete_module syscall
35#warning -> The delete_module system call is being stubbed out...
36 errno=ENOSYS;
37 return -1;
38#else
37 return(syscall(__NR_delete_module, name)); 39 return(syscall(__NR_delete_module, name));
40#endif
38} 41}
42
39int get_kernel_syms(__ptr_t ks) 43int get_kernel_syms(__ptr_t ks)
40{ 44{
45#ifndef __NR_get_kernel_syms
46#warning This kernel does not support the get_kernel_syms syscall
47#warning -> The get_kernel_syms system call is being stubbed out...
48 errno=ENOSYS;
49 return -1;
50#else
41 return(syscall(__NR_get_kernel_syms, ks)); 51 return(syscall(__NR_get_kernel_syms, ks));
52#endif
42} 53}
43 54
44/* This may have 5 arguments (for old 2.0 kernels) or 2 arguments 55/* This may have 5 arguments (for old 2.0 kernels) or 2 arguments
@@ -46,7 +57,14 @@ int get_kernel_syms(__ptr_t ks)
46 * and let the kernel cope with whatever it gets. Its good at that. */ 57 * and let the kernel cope with whatever it gets. Its good at that. */
47int init_module(void *first, void *second, void *third, void *fourth, void *fifth) 58int init_module(void *first, void *second, void *third, void *fourth, void *fifth)
48{ 59{
60#ifndef __NR_init_module
61#warning This kernel does not support the init_module syscall
62#warning -> The init_module system call is being stubbed out...
63 errno=ENOSYS;
64 return -1;
65#else
49 return(syscall(__NR_init_module, first, second, third, fourth, fifth)); 66 return(syscall(__NR_init_module, first, second, third, fourth, fifth));
67#endif
50} 68}
51 69
52int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret) 70int 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
66/* Jump through hoops to fixup error return codes */ 84/* Jump through hoops to fixup error return codes */
67unsigned long create_module(const char *name, size_t size) 85unsigned long create_module(const char *name, size_t size)
68{ 86{
87#ifndef __NR_create_module
88#warning This kernel does not support the create_module syscall
89#warning -> The create_module system call is being stubbed out...
90 errno=ENOSYS;
91 return -1;
92#else
69 long ret = syscall(__NR_create_module, name, size); 93 long ret = syscall(__NR_create_module, name, size);
70 94
71 if (ret == -1 && errno > 125) { 95 if (ret == -1 && errno > 125) {
@@ -73,9 +97,8 @@ unsigned long create_module(const char *name, size_t size)
73 errno = 0; 97 errno = 0;
74 } 98 }
75 return ret; 99 return ret;
76}
77
78#endif 100#endif
101}
79 102
80 103
81/* END CODE */ 104/* END CODE */