diff options
Diffstat (limited to 'modutils/lsmod.c')
-rw-r--r-- | modutils/lsmod.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/modutils/lsmod.c b/modutils/lsmod.c index a2a582389..a03247f73 100644 --- a/modutils/lsmod.c +++ b/modutils/lsmod.c | |||
@@ -40,13 +40,15 @@ | |||
40 | #include "busybox.h" | 40 | #include "busybox.h" |
41 | 41 | ||
42 | 42 | ||
43 | 43 | #ifndef CONFIG_FEATURE_CHECK_TAINTED_MODULE | |
44 | static inline void check_tainted(void) { printf("\n"); } | ||
45 | #else | ||
44 | #define TAINT_FILENAME "/proc/sys/kernel/tainted" | 46 | #define TAINT_FILENAME "/proc/sys/kernel/tainted" |
45 | #define TAINT_PROPRIETORY_MODULE (1<<0) | 47 | #define TAINT_PROPRIETORY_MODULE (1<<0) |
46 | #define TAINT_FORCED_MODULE (1<<1) | 48 | #define TAINT_FORCED_MODULE (1<<1) |
47 | #define TAINT_UNSAFE_SMP (1<<2) | 49 | #define TAINT_UNSAFE_SMP (1<<2) |
48 | 50 | ||
49 | void check_tainted(void) | 51 | static void check_tainted(void) |
50 | { | 52 | { |
51 | int tainted; | 53 | int tainted; |
52 | FILE *f; | 54 | FILE *f; |
@@ -66,6 +68,7 @@ void check_tainted(void) | |||
66 | printf(" Not tainted\n"); | 68 | printf(" Not tainted\n"); |
67 | } | 69 | } |
68 | } | 70 | } |
71 | #endif | ||
69 | 72 | ||
70 | #ifdef CONFIG_FEATURE_QUERY_MODULE_INTERFACE | 73 | #ifdef CONFIG_FEATURE_QUERY_MODULE_INTERFACE |
71 | 74 | ||
@@ -111,6 +114,7 @@ static int my_query_module(const char *name, int which, void **buf, | |||
111 | 114 | ||
112 | return my_ret; | 115 | return my_ret; |
113 | } | 116 | } |
117 | #endif | ||
114 | 118 | ||
115 | extern int lsmod_main(int argc, char **argv) | 119 | extern int lsmod_main(int argc, char **argv) |
116 | { | 120 | { |
@@ -170,26 +174,16 @@ extern int lsmod_main(int argc, char **argv) | |||
170 | return( 0); | 174 | return( 0); |
171 | } | 175 | } |
172 | 176 | ||
173 | #else /*CONFIG_FEATURE_OLD_MODULE_INTERFACE*/ | 177 | #else /* CONFIG_FEATURE_QUERY_MODULE_INTERFACE */ |
174 | 178 | ||
175 | extern int lsmod_main(int argc, char **argv) | 179 | extern int lsmod_main(int argc, char **argv) |
176 | { | 180 | { |
177 | int fd, i; | ||
178 | char line[128]; | ||
179 | |||
180 | printf("Module Size Used by"); | 181 | printf("Module Size Used by"); |
181 | check_tainted(); | 182 | check_tainted(); |
182 | fflush(stdout); | ||
183 | 183 | ||
184 | if ((fd = open("/proc/modules", O_RDONLY)) >= 0 ) { | 184 | if(print_file_by_name("/proc/modules") == FALSE) |
185 | while ((i = read(fd, line, sizeof(line))) > 0) { | ||
186 | write(fileno(stdout), line, i); | ||
187 | } | ||
188 | close(fd); | ||
189 | return 0; | ||
190 | } | ||
191 | perror_msg_and_die("/proc/modules"); | ||
192 | return 1; | 185 | return 1; |
186 | return 0; | ||
193 | } | 187 | } |
194 | 188 | ||
195 | #endif /*CONFIG_FEATURE_OLD_MODULE_INTERFACE*/ | 189 | #endif /* CONFIG_FEATURE_QUERY_MODULE_INTERFACE */ |