summaryrefslogtreecommitdiff
path: root/modutils
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
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')
-rw-r--r--modutils/config.in4
-rw-r--r--modutils/insmod.c8
-rw-r--r--modutils/lsmod.c26
3 files changed, 20 insertions, 18 deletions
diff --git a/modutils/config.in b/modutils/config.in
index 7fe7ec195..10b0a9c33 100644
--- a/modutils/config.in
+++ b/modutils/config.in
@@ -29,5 +29,9 @@ if [ "$CONFIG_LSMOD" = "y" ]; then
29 fi 29 fi
30fi 30fi
31 31
32if [ "$CONFIG_INSMOD" = "y" -o "$CONFIG_LSMOD" = "y" ]; then
33 bool 'Support tainted module checking with new kernels' CONFIG_FEATURE_CHECK_TAINTED_MODULE
34fi
35
32endmenu 36endmenu
33 37
diff --git a/modutils/insmod.c b/modutils/insmod.c
index b246d90af..b367e84af 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -234,7 +234,7 @@
234#ifndef MODUTILS_MODULE_H 234#ifndef MODUTILS_MODULE_H
235static const int MODUTILS_MODULE_H = 1; 235static const int MODUTILS_MODULE_H = 1;
236 236
237#ident "$Id: insmod.c,v 1.90 2002/09/16 05:30:24 andersen Exp $" 237#ident "$Id: insmod.c,v 1.91 2002/10/10 04:20:21 andersen Exp $"
238 238
239/* This file contains the structures used by the 2.0 and 2.1 kernels. 239/* This file contains the structures used by the 2.0 and 2.1 kernels.
240 We do not use the kernel headers directly because we do not wish 240 We do not use the kernel headers directly because we do not wish
@@ -455,7 +455,7 @@ int delete_module(const char *);
455#ifndef MODUTILS_OBJ_H 455#ifndef MODUTILS_OBJ_H
456static const int MODUTILS_OBJ_H = 1; 456static const int MODUTILS_OBJ_H = 1;
457 457
458#ident "$Id: insmod.c,v 1.90 2002/09/16 05:30:24 andersen Exp $" 458#ident "$Id: insmod.c,v 1.91 2002/10/10 04:20:21 andersen Exp $"
459 459
460/* The relocatable object is manipulated using elfin types. */ 460/* The relocatable object is manipulated using elfin types. */
461 461
@@ -3422,6 +3422,7 @@ static void hide_special_symbols(struct obj_file *f)
3422 ELFW(ST_INFO) (STB_LOCAL, ELFW(ST_TYPE) (sym->info)); 3422 ELFW(ST_INFO) (STB_LOCAL, ELFW(ST_TYPE) (sym->info));
3423} 3423}
3424 3424
3425#ifdef CONFIG_FEATURE_CHECK_TAINTED_MODULE
3425static int obj_gpl_license(struct obj_file *f, const char **license) 3426static int obj_gpl_license(struct obj_file *f, const char **license)
3426{ 3427{
3427 struct obj_section *sec; 3428 struct obj_section *sec;
@@ -3533,6 +3534,9 @@ static void check_tainted_module(struct obj_file *f, char *m_name)
3533 if (fd >= 0) 3534 if (fd >= 0)
3534 close(fd); 3535 close(fd);
3535} 3536}
3537#else /* CONFIG_FEATURE_CHECK_TAINTED_MODULE */
3538#define check_tainted_module(x, y) do { } while(0);
3539#endif /* CONFIG_FEATURE_CHECK_TAINTED_MODULE */
3536 3540
3537extern int insmod_main( int argc, char **argv) 3541extern int insmod_main( int argc, char **argv)
3538{ 3542{
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 */