diff options
author | Eric Andersen <andersen@codepoet.org> | 2004-07-13 00:09:34 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2004-07-13 00:09:34 +0000 |
commit | e8521f14a22d4227fa7bdc83868919f9f43e7dfa (patch) | |
tree | d6c9dd1e91c8d61e79b416a756368abbbd035a67 | |
parent | fe9b9cdfa59fabea11e0b2d45336f19d627fd25f (diff) | |
download | busybox-w32-e8521f14a22d4227fa7bdc83868919f9f43e7dfa.tar.gz busybox-w32-e8521f14a22d4227fa7bdc83868919f9f43e7dfa.tar.bz2 busybox-w32-e8521f14a22d4227fa7bdc83868919f9f43e7dfa.zip |
Fixup some cases of "QM_MODULES: not implemented" for both
lsmod and rmmod when using 2.6.x module support
-Erik
-rw-r--r-- | modutils/Config.in | 8 | ||||
-rw-r--r-- | modutils/rmmod.c | 15 |
2 files changed, 13 insertions, 10 deletions
diff --git a/modutils/Config.in b/modutils/Config.in index 3b5c1e37a..05ff8c9d2 100644 --- a/modutils/Config.in +++ b/modutils/Config.in | |||
@@ -81,13 +81,7 @@ config CONFIG_LSMOD | |||
81 | lsmod is used to display a list of loaded modules. | 81 | lsmod is used to display a list of loaded modules. |
82 | 82 | ||
83 | config CONFIG_FEATURE_QUERY_MODULE_INTERFACE | 83 | config CONFIG_FEATURE_QUERY_MODULE_INTERFACE |
84 | bool " Support lsmod query_module interface (add 638 bytes)" | 84 | depends on CONFIG_FEATURE_2_4_MODULES && !CONFIG_FEATURE_2_6_MODULES |
85 | default y | ||
86 | depends on CONFIG_LSMOD && ( CONFIG_FEATURE_2_4_MODULES || CONFIG_FEATURE_2_6_MODULES ) | ||
87 | help | ||
88 | This will provide some extra information about each module when | ||
89 | running lsmod. The fields provided are address, size, flags and | ||
90 | usage count. | ||
91 | 85 | ||
92 | config CONFIG_MODPROBE | 86 | config CONFIG_MODPROBE |
93 | bool "modprobe" | 87 | bool "modprobe" |
diff --git a/modutils/rmmod.c b/modutils/rmmod.c index c83904551..5576eb6a1 100644 --- a/modutils/rmmod.c +++ b/modutils/rmmod.c | |||
@@ -34,9 +34,11 @@ extern int rmmod_main(int argc, char **argv) | |||
34 | int n, ret = EXIT_SUCCESS; | 34 | int n, ret = EXIT_SUCCESS; |
35 | size_t nmod = 0; /* number of modules */ | 35 | size_t nmod = 0; /* number of modules */ |
36 | size_t pnmod = -1; /* previous number of modules */ | 36 | size_t pnmod = -1; /* previous number of modules */ |
37 | unsigned int flags = O_NONBLOCK|O_EXCL; | ||
38 | #ifdef CONFIG_FEATURE_QUERY_MODULE_INTERFACE | ||
37 | void *buf; /* hold the module names which we ignore but must get */ | 39 | void *buf; /* hold the module names which we ignore but must get */ |
38 | size_t bufsize = 0; | 40 | size_t bufsize = 0; |
39 | unsigned int flags = O_NONBLOCK|O_EXCL; | 41 | #endif |
40 | 42 | ||
41 | /* Parse command line. */ | 43 | /* Parse command line. */ |
42 | while ((n = getopt(argc, argv, "a")) != EOF) { | 44 | while ((n = getopt(argc, argv, "a")) != EOF) { |
@@ -50,17 +52,24 @@ extern int rmmod_main(int argc, char **argv) | |||
50 | case 'a': | 52 | case 'a': |
51 | /* Unload _all_ unused modules via NULL delete_module() call */ | 53 | /* Unload _all_ unused modules via NULL delete_module() call */ |
52 | /* until the number of modules does not change */ | 54 | /* until the number of modules does not change */ |
55 | #ifdef CONFIG_FEATURE_QUERY_MODULE_INTERFACE | ||
53 | buf = xmalloc(bufsize = 256); | 56 | buf = xmalloc(bufsize = 256); |
57 | #endif | ||
54 | while (nmod != pnmod) { | 58 | while (nmod != pnmod) { |
55 | if (syscall(__NR_delete_module, NULL, flags) < 0) | 59 | if (syscall(__NR_delete_module, NULL, flags) < 0) { |
60 | if (errno==EFAULT) | ||
61 | return(ret); | ||
56 | bb_perror_msg_and_die("rmmod"); | 62 | bb_perror_msg_and_die("rmmod"); |
63 | } | ||
57 | pnmod = nmod; | 64 | pnmod = nmod; |
65 | #ifdef CONFIG_FEATURE_QUERY_MODULE_INTERFACE | ||
58 | /* 1 == QM_MODULES */ | 66 | /* 1 == QM_MODULES */ |
59 | if (my_query_module(NULL, 1, &buf, &bufsize, &nmod)) { | 67 | if (my_query_module(NULL, 1, &buf, &bufsize, &nmod)) { |
60 | bb_perror_msg_and_die("QM_MODULES"); | 68 | bb_perror_msg_and_die("QM_MODULES"); |
61 | } | 69 | } |
70 | #endif | ||
62 | } | 71 | } |
63 | #ifdef CONFIG_FEATURE_CLEAN_UP | 72 | #if defined CONFIG_FEATURE_CLEAN_UP && CONFIG_FEATURE_QUERY_MODULE_INTERFACE |
64 | free(buf); | 73 | free(buf); |
65 | #endif | 74 | #endif |
66 | return EXIT_SUCCESS; | 75 | return EXIT_SUCCESS; |