[BusyBox] lsmod: QM_MODULES: No space left on device

David Douthitt ssrat at mailbag.com
Fri Apr 13 12:31:54 UTC 2001


It was reported in the LEAF-DEVEL (LRP variant Developers) list that
lsmod generated this error with all the iptables modules and three
network modules loaded.  I swiped some code from insmod which handles
this error with a xremalloc and a retry, and cribbed the code into
lsmod.c.  It seems to work, although I don't think I can properly test
it without finding something with a lot of modules.  With my Red Hat
installation and 7 modules, it worked anyways.

Here's the patch...
-------------- next part --------------
--- busybox/lsmod.c	Wed Apr  4 22:14:39 2001
+++ busybox-0.51pre/lsmod.c	Fri Apr 13 07:07:30 2001
@@ -78,7 +78,12 @@
 
 	module_names = xmalloc(bufsize = 256);
 	deps = xmalloc(bufsize);
+  retry_modules_load:
 	if (query_module(NULL, QM_MODULES, module_names, bufsize, &nmod)) {
+		if (errno == ENOSPC) {
+			module_names = xrealloc(module_names, bufsize = nmod);
+			goto retry_modules_load;
+		}
 		perror_msg_and_die("QM_MODULES");
 	}
 


More information about the busybox mailing list