Skip to contentSkip to conversation

Put more useful stuff in /proc/modules

PATCH New Rusty Russell 1 participant 1 message Jan 11, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Put more useful stuff in /proc/modules

Linus, please apply.

This puts the state of the module (useful for users) and the address (required for ksymoops and oprofile).

Cheers,
Rusty.

Name: Put more information in /proc/modules
Author: Stanley Wang, Rusty Russell
Status: Tested on 2.5.56

D: Puts the state of the module and the address in /proc/modules.

kernel/module.c +9 -0
diff -urNp --exclude TAGS -X /home/rusty/current-dontdiff --minimal linux-2.5-bk/kernel/module.c working-2.5-bk-procmodules-extra/kernel/module.c
@@ -1422,6 +1422,15 @@ static int m_show(struct seq_file *m, vo
 	seq_printf(m, "%s %lu",
 		   mod->name, mod->init_size + mod->core_size);
 	print_unload_info(m, mod);
+
+	/* Informative for users. */
+	seq_printf(m, " %s",
+		   mod->state == MODULE_STATE_GOING ? "Unloading":
+		   mod->state == MODULE_STATE_COMING ? "Loading":
+		   "Live");
+	/* Used by oprofile and other similar tools. */
+	seq_printf(m, " 0x%p", mod->module_core);
+
 	seq_printf(m, "\n");
 	return 0;
 }

--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.