[BusyBox] [PATCH] fix lsmod for kernel-2.6

Takeharu KATO takeharu1219 at ybb.ne.jp
Wed May 4 15:07:28 MDT 2005


Hi Rob:

Rob Landley wrote:
> 
> Well, presumably since it's #ifdefed out you could get the ugly output by 
> undefining the symbol.  Unfortunately, the same symbol is used for insmod 2.6 
> support, isn't it?
> 
> As I said, I don't use this bit.  I mainly verified that it compiled...
> 
I fixed this issue.
I adopted a new option(CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT) for this 
feature.
Sorry to trouble you, could you apply this patch?

Regards,


-------------- next part --------------
diff -Nbupr busybox.orig/modutils/Config.in busybox/modutils/Config.in
--- busybox.orig/modutils/Config.in	2005-05-04 09:25:49.000000000 +0900
+++ busybox/modutils/Config.in	2005-05-05 05:44:14.000000000 +0900
@@ -18,6 +18,13 @@ config CONFIG_FEATURE_2_4_MODULES
 	help
 	  Support module loading for 2.2.x and 2.4.x Linux kernels.
 
+config CONFIG_FEATURE_2_6_MODULES
+	bool "  Support version 2.6.x Linux kernels"
+	default n
+	depends on CONFIG_INSMOD 
+	help
+	  Support module loading for newer 2.6.x Linux kernels.
+
 config CONFIG_FEATURE_INSMOD_VERSION_CHECKING
 	bool "  Module version checking"
 	default n
@@ -73,12 +80,13 @@ config CONFIG_LSMOD
 	help
 	  lsmod is used to display a list of loaded modules.
 
-config CONFIG_FEATURE_2_6_MODULES
-	bool "  Support version 2.6.x Linux kernels"
+config CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT
+	bool "  lsmod pretty output for 2.6.x Linux kernels "
 	default n
-	depends on CONFIG_INSMOD || CONFIG_LSMOD
+	depends on CONFIG_LSMOD 
 	help
-	  Support module loading for newer 2.6.x Linux kernels.
+	  This option makes output format of lsmod adjusted to 
+	  the format of module-init-tools for Linux kernel 2.6.
 
 config CONFIG_FEATURE_QUERY_MODULE_INTERFACE
 	bool
diff -Nbupr busybox.orig/modutils/lsmod.c busybox/modutils/lsmod.c
--- busybox.orig/modutils/lsmod.c	2005-05-04 07:34:03.000000000 +0900
+++ busybox/modutils/lsmod.c	2005-05-05 05:32:19.000000000 +0900
@@ -164,7 +164,7 @@ extern int lsmod_main(int argc, char **a
 {
 	printf("Module                  Size  Used by");
 	check_tainted();
-#if defined(CONFIG_FEATURE_2_6_MODULES)
+#if defined(CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT)
 	{
 	  FILE *file;
 	  char line[4096];
@@ -204,6 +204,7 @@ extern int lsmod_main(int argc, char **a
 	  }
 	  fclose(file);
 	}
+	return 0;  /* Success  */
 #else
 	if (bb_xprint_file_by_name("/proc/modules") < 0) {
 		return 0;


More information about the busybox mailing list