[BusyBox-cvs] CVS update of busybox/modutils (Config.in rmmod.c)

Erik Andersen andersen at codepoet.org
Tue Jul 13 00:09:36 UTC 2004


    Date: Monday, July 12, 2004 @ 18:09:36
  Author: andersen
    Path: /var/cvs/busybox/modutils

Modified: Config.in (1.13 -> 1.14) rmmod.c (1.28 -> 1.29)

Fixup some cases of "QM_MODULES: not implemented" for both
lsmod and rmmod when using 2.6.x module support
 -Erik


Index: busybox/modutils/Config.in
diff -u busybox/modutils/Config.in:1.13 busybox/modutils/Config.in:1.14
--- busybox/modutils/Config.in:1.13	Tue Jun 22 05:50:52 2004
+++ busybox/modutils/Config.in	Mon Jul 12 18:09:34 2004
@@ -81,13 +81,7 @@
 	  lsmod is used to display a list of loaded modules.
 
 config CONFIG_FEATURE_QUERY_MODULE_INTERFACE
-	bool "  Support lsmod query_module interface (add 638 bytes)"
-	default y
-	depends on CONFIG_LSMOD && ( CONFIG_FEATURE_2_4_MODULES || CONFIG_FEATURE_2_6_MODULES )
-	help
-	  This will provide some extra information about each module when
-	  running lsmod.  The fields provided are address, size, flags and
-	  usage count.
+	depends on CONFIG_FEATURE_2_4_MODULES && !CONFIG_FEATURE_2_6_MODULES
 
 config CONFIG_MODPROBE
 	bool "modprobe"
Index: busybox/modutils/rmmod.c
diff -u busybox/modutils/rmmod.c:1.28 busybox/modutils/rmmod.c:1.29
--- busybox/modutils/rmmod.c:1.28	Fri Mar 19 14:00:03 2004
+++ busybox/modutils/rmmod.c	Mon Jul 12 18:09:34 2004
@@ -34,9 +34,11 @@
 	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 @@
 			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;



More information about the busybox-cvs mailing list