diff options
-rw-r--r-- | modutils/insmod.c | 9 | ||||
-rw-r--r-- | modutils/rmmod.c | 12 |
2 files changed, 16 insertions, 5 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c index f7e9a6672..30d471b78 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
@@ -4184,8 +4184,14 @@ int insmod_main(int argc, char **argv) | |||
4184 | #if ENABLE_FEATURE_2_6_MODULES | 4184 | #if ENABLE_FEATURE_2_6_MODULES |
4185 | 4185 | ||
4186 | #include <sys/mman.h> | 4186 | #include <sys/mman.h> |
4187 | |||
4188 | #ifdef __UCLIBC__ | ||
4189 | extern int init_module(void *module, unsigned long len, const char *options); | ||
4190 | #else | ||
4187 | #include <asm/unistd.h> | 4191 | #include <asm/unistd.h> |
4188 | #include <sys/syscall.h> | 4192 | #include <sys/syscall.h> |
4193 | #define init_module(mod, len, opts) syscall(__NR_init_module, mod, len, opts) | ||
4194 | #endif | ||
4189 | 4195 | ||
4190 | /* We use error numbers in a loose translation... */ | 4196 | /* We use error numbers in a loose translation... */ |
4191 | static const char *moderror(int err) | 4197 | static const char *moderror(int err) |
@@ -4257,10 +4263,9 @@ static int insmod_ng_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
4257 | map = xmalloc_open_read_close(filename, &len); | 4263 | map = xmalloc_open_read_close(filename, &len); |
4258 | #endif | 4264 | #endif |
4259 | 4265 | ||
4260 | if (syscall(__NR_init_module, map, len, options) != 0) | 4266 | if (init_module(map, len, options) != 0) |
4261 | bb_error_msg_and_die("cannot insert '%s': %s", | 4267 | bb_error_msg_and_die("cannot insert '%s': %s", |
4262 | filename, moderror(errno)); | 4268 | filename, moderror(errno)); |
4263 | |||
4264 | return 0; | 4269 | return 0; |
4265 | } | 4270 | } |
4266 | 4271 | ||
diff --git a/modutils/rmmod.c b/modutils/rmmod.c index 61cfbd147..a96a27457 100644 --- a/modutils/rmmod.c +++ b/modutils/rmmod.c | |||
@@ -8,7 +8,13 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include "libbb.h" | 10 | #include "libbb.h" |
11 | #include <sys/syscall.h> | 11 | |
12 | #ifdef __UCLIBC__ | ||
13 | extern int delete_module(const char *module, unsigned int flags); | ||
14 | #else | ||
15 | # include <sys/syscall.h> | ||
16 | # define delete_module(mod, flags) syscall(__NR_delete_module, mod, flags) | ||
17 | #endif | ||
12 | 18 | ||
13 | #if ENABLE_FEATURE_2_6_MODULES | 19 | #if ENABLE_FEATURE_2_6_MODULES |
14 | static inline void filename2modname(char *modname, const char *afterslash) | 20 | static inline void filename2modname(char *modname, const char *afterslash) |
@@ -59,7 +65,7 @@ int rmmod_main(int argc, char **argv) | |||
59 | size_t pnmod = -1; /* previous number of modules */ | 65 | size_t pnmod = -1; /* previous number of modules */ |
60 | 66 | ||
61 | while (nmod != pnmod) { | 67 | while (nmod != pnmod) { |
62 | if (syscall(__NR_delete_module, NULL, flags) != 0) { | 68 | if (delete_module(NULL, flags) != 0) { |
63 | if (errno == EFAULT) | 69 | if (errno == EFAULT) |
64 | return ret; | 70 | return ret; |
65 | bb_perror_msg_and_die("rmmod"); | 71 | bb_perror_msg_and_die("rmmod"); |
@@ -84,7 +90,7 @@ int rmmod_main(int argc, char **argv) | |||
84 | filename2modname(misc_buf, bb_basename(argv[n])); | 90 | filename2modname(misc_buf, bb_basename(argv[n])); |
85 | } | 91 | } |
86 | 92 | ||
87 | if (syscall(__NR_delete_module, ENABLE_FEATURE_2_6_MODULES ? misc_buf : argv[n], flags)) { | 93 | if (delete_module(ENABLE_FEATURE_2_6_MODULES ? misc_buf : argv[n], flags)) { |
88 | bb_simple_perror_msg(argv[n]); | 94 | bb_simple_perror_msg(argv[n]); |
89 | ret = EXIT_FAILURE; | 95 | ret = EXIT_FAILURE; |
90 | } | 96 | } |