diff options
author | Eric Andersen | 2000-09-10 16:16:00 +0000 |
---|---|---|
committer | Eric Andersen | 2000-09-10 16:16:00 +0000 |
commit | de34e4375565cbe1b60c2d99afddfb6c7c45b3ad (patch) | |
tree | 428572d075b1b06dbe7ebe1f48f64becdc380a7c | |
parent | cbb61c78ae97e5e205cb4403f4f458a36ffec582 (diff) | |
download | busybox-de34e4375565cbe1b60c2d99afddfb6c7c45b3ad.zip busybox-de34e4375565cbe1b60c2d99afddfb6c7c45b3ad.tar.gz |
MAke lsmod act just like modutils lsmod, by printing which modules use
other modules, and state info like (deleted) and such.
-Erik
-rw-r--r-- | lsmod.c | 20 | ||||
-rw-r--r-- | modutils/lsmod.c | 20 |
2 files changed, 40 insertions, 0 deletions
@@ -54,6 +54,13 @@ int query_module(const char *name, int which, void *buf, size_t bufsize, #define QM_SYMBOLS 4 #define QM_INFO 5 +/* Bits of module.flags. */ +#define NEW_MOD_RUNNING 1 +#define NEW_MOD_DELETED 2 +#define NEW_MOD_AUTOCLEAN 4 +#define NEW_MOD_VISITED 8 +#define NEW_MOD_USED_ONCE 16 +#define NEW_MOD_INITIALIZING 64 extern int lsmod_main(int argc, char **argv) @@ -95,6 +102,19 @@ extern int lsmod_main(int argc, char **argv) } if (count) printf("]"); printf("\n"); + + if (info.flags & NEW_MOD_DELETED) + printf(" (deleted)"); + else if (info.flags & NEW_MOD_INITIALIZING) + printf(" (initializing)"); + else if (!(info.flags & NEW_MOD_RUNNING)) + printf(" (uninitialized)"); + else { + if (info.flags & NEW_MOD_AUTOCLEAN) + printf(" (autoclean)"); + if (!(info.flags & NEW_MOD_USED_ONCE)) + printf(" (unused)"); + } } diff --git a/modutils/lsmod.c b/modutils/lsmod.c index 2a238cd..945f420 100644 --- a/modutils/lsmod.c +++ b/modutils/lsmod.c @@ -54,6 +54,13 @@ int query_module(const char *name, int which, void *buf, size_t bufsize, #define QM_SYMBOLS 4 #define QM_INFO 5 +/* Bits of module.flags. */ +#define NEW_MOD_RUNNING 1 +#define NEW_MOD_DELETED 2 +#define NEW_MOD_AUTOCLEAN 4 +#define NEW_MOD_VISITED 8 +#define NEW_MOD_USED_ONCE 16 +#define NEW_MOD_INITIALIZING 64 extern int lsmod_main(int argc, char **argv) @@ -95,6 +102,19 @@ extern int lsmod_main(int argc, char **argv) } if (count) printf("]"); printf("\n"); + + if (info.flags & NEW_MOD_DELETED) + printf(" (deleted)"); + else if (info.flags & NEW_MOD_INITIALIZING) + printf(" (initializing)"); + else if (!(info.flags & NEW_MOD_RUNNING)) + printf(" (uninitialized)"); + else { + if (info.flags & NEW_MOD_AUTOCLEAN) + printf(" (autoclean)"); + if (!(info.flags & NEW_MOD_USED_ONCE)) + printf(" (unused)"); + } } |