aboutsummaryrefslogtreecommitdiff
path: root/modutils/lsmod.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-10-10 04:20:21 +0000
committerEric Andersen <andersen@codepoet.org>2002-10-10 04:20:21 +0000
commit71ae64bdc6b044eef0a9f3bebd85cc4a6b67362f (patch)
tree802990cf39a805f253b9d32f3888a7c749babd01 /modutils/lsmod.c
parentfdfe298a966da0e6eecdc355efd640acf73c00e5 (diff)
downloadbusybox-w32-71ae64bdc6b044eef0a9f3bebd85cc4a6b67362f.tar.gz
busybox-w32-71ae64bdc6b044eef0a9f3bebd85cc4a6b67362f.tar.bz2
busybox-w32-71ae64bdc6b044eef0a9f3bebd85cc4a6b67362f.zip
last_patch61 from vodz:
New complex patch for decrease size devel version. Requires previous patch. Also removed small problems from dutmp and tar applets. Also includes vodz' last_patch61_2: Last patch correcting comment for #endif and more integrated with libbb (very reduce size if used "cat" applet also). Requires last_patch61 for modutils/config.in.
Diffstat (limited to 'modutils/lsmod.c')
-rw-r--r--modutils/lsmod.c26
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
44static 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
49void check_tainted(void) 51static 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
115extern int lsmod_main(int argc, char **argv) 119extern 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
175extern int lsmod_main(int argc, char **argv) 179extern 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 */