aboutsummaryrefslogtreecommitdiff
path: root/modutils/rmmod.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-07-13 00:09:34 +0000
committerEric Andersen <andersen@codepoet.org>2004-07-13 00:09:34 +0000
commite8521f14a22d4227fa7bdc83868919f9f43e7dfa (patch)
treed6c9dd1e91c8d61e79b416a756368abbbd035a67 /modutils/rmmod.c
parentfe9b9cdfa59fabea11e0b2d45336f19d627fd25f (diff)
downloadbusybox-e8521f14a22d4227fa7bdc83868919f9f43e7dfa.tar.gz
Fixup some cases of "QM_MODULES: not implemented" for both
lsmod and rmmod when using 2.6.x module support -Erik
Diffstat (limited to 'modutils/rmmod.c')
-rw-r--r--modutils/rmmod.c15
1 files changed, 12 insertions, 3 deletions
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)
int n, ret = EXIT_SUCCESS;
size_t nmod = 0; /* number of modules */
size_t pnmod = -1; /* previous number of modules */
+ unsigned int flags = O_NONBLOCK|O_EXCL;
+#ifdef CONFIG_FEATURE_QUERY_MODULE_INTERFACE
void *buf; /* hold the module names which we ignore but must get */
size_t bufsize = 0;
- unsigned int flags = O_NONBLOCK|O_EXCL;
+#endif
/* Parse command line. */
while ((n = getopt(argc, argv, "a")) != EOF) {
@@ -50,17 +52,24 @@ extern int rmmod_main(int argc, char **argv)
case 'a':
/* Unload _all_ unused modules via NULL delete_module() call */
/* until the number of modules does not change */
+#ifdef CONFIG_FEATURE_QUERY_MODULE_INTERFACE
buf = xmalloc(bufsize = 256);
+#endif
while (nmod != pnmod) {
- if (syscall(__NR_delete_module, NULL, flags) < 0)
+ if (syscall(__NR_delete_module, NULL, flags) < 0) {
+ if (errno==EFAULT)
+ return(ret);
bb_perror_msg_and_die("rmmod");
+ }
pnmod = nmod;
+#ifdef CONFIG_FEATURE_QUERY_MODULE_INTERFACE
/* 1 == QM_MODULES */
if (my_query_module(NULL, 1, &buf, &bufsize, &nmod)) {
bb_perror_msg_and_die("QM_MODULES");
}
+#endif
}
-#ifdef CONFIG_FEATURE_CLEAN_UP
+#if defined CONFIG_FEATURE_CLEAN_UP && CONFIG_FEATURE_QUERY_MODULE_INTERFACE
free(buf);
#endif
return EXIT_SUCCESS;