summaryrefslogtreecommitdiff
path: root/modutils
diff options
context:
space:
mode:
authorEric Andersen2002-10-10 04:20:21 +0000
committerEric Andersen2002-10-10 04:20:21 +0000
commit71ae64bdc6b044eef0a9f3bebd85cc4a6b67362f (patch)
tree802990cf39a805f253b9d32f3888a7c749babd01 /modutils
parentfdfe298a966da0e6eecdc355efd640acf73c00e5 (diff)
downloadbusybox-71ae64bdc6b044eef0a9f3bebd85cc4a6b67362f.zip
busybox-71ae64bdc6b044eef0a9f3bebd85cc4a6b67362f.tar.gz
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 7fe7ec1..10b0a9c 100644
--- a/modutils/config.in
+++ b/modutils/config.in
@@ -29,5 +29,9 @@ if [ "$CONFIG_LSMOD" = "y" ]; then
fi
fi
+if [ "$CONFIG_INSMOD" = "y" -o "$CONFIG_LSMOD" = "y" ]; then
+ bool 'Support tainted module checking with new kernels' CONFIG_FEATURE_CHECK_TAINTED_MODULE
+fi
+
endmenu
diff --git a/modutils/insmod.c b/modutils/insmod.c
index b246d90..b367e84 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -234,7 +234,7 @@
#ifndef MODUTILS_MODULE_H
static const int MODUTILS_MODULE_H = 1;
-#ident "$Id: insmod.c,v 1.90 2002/09/16 05:30:24 andersen Exp $"
+#ident "$Id: insmod.c,v 1.91 2002/10/10 04:20:21 andersen Exp $"
/* This file contains the structures used by the 2.0 and 2.1 kernels.
We do not use the kernel headers directly because we do not wish
@@ -455,7 +455,7 @@ int delete_module(const char *);
#ifndef MODUTILS_OBJ_H
static const int MODUTILS_OBJ_H = 1;
-#ident "$Id: insmod.c,v 1.90 2002/09/16 05:30:24 andersen Exp $"
+#ident "$Id: insmod.c,v 1.91 2002/10/10 04:20:21 andersen Exp $"
/* The relocatable object is manipulated using elfin types. */
@@ -3422,6 +3422,7 @@ static void hide_special_symbols(struct obj_file *f)
ELFW(ST_INFO) (STB_LOCAL, ELFW(ST_TYPE) (sym->info));
}
+#ifdef CONFIG_FEATURE_CHECK_TAINTED_MODULE
static int obj_gpl_license(struct obj_file *f, const char **license)
{
struct obj_section *sec;
@@ -3533,6 +3534,9 @@ static void check_tainted_module(struct obj_file *f, char *m_name)
if (fd >= 0)
close(fd);
}
+#else /* CONFIG_FEATURE_CHECK_TAINTED_MODULE */
+#define check_tainted_module(x, y) do { } while(0);
+#endif /* CONFIG_FEATURE_CHECK_TAINTED_MODULE */
extern int insmod_main( int argc, char **argv)
{
diff --git a/modutils/lsmod.c b/modutils/lsmod.c
index a2a5823..a03247f 100644
--- a/modutils/lsmod.c
+++ b/modutils/lsmod.c
@@ -40,13 +40,15 @@
#include "busybox.h"
-
+#ifndef CONFIG_FEATURE_CHECK_TAINTED_MODULE
+static inline void check_tainted(void) { printf("\n"); }
+#else
#define TAINT_FILENAME "/proc/sys/kernel/tainted"
#define TAINT_PROPRIETORY_MODULE (1<<0)
#define TAINT_FORCED_MODULE (1<<1)
#define TAINT_UNSAFE_SMP (1<<2)
-void check_tainted(void)
+static void check_tainted(void)
{
int tainted;
FILE *f;
@@ -66,6 +68,7 @@ void check_tainted(void)
printf(" Not tainted\n");
}
}
+#endif
#ifdef CONFIG_FEATURE_QUERY_MODULE_INTERFACE
@@ -111,6 +114,7 @@ static int my_query_module(const char *name, int which, void **buf,
return my_ret;
}
+#endif
extern int lsmod_main(int argc, char **argv)
{
@@ -170,26 +174,16 @@ extern int lsmod_main(int argc, char **argv)
return( 0);
}
-#else /*CONFIG_FEATURE_OLD_MODULE_INTERFACE*/
+#else /* CONFIG_FEATURE_QUERY_MODULE_INTERFACE */
extern int lsmod_main(int argc, char **argv)
{
- int fd, i;
- char line[128];
-
printf("Module Size Used by");
check_tainted();
- fflush(stdout);
- if ((fd = open("/proc/modules", O_RDONLY)) >= 0 ) {
- while ((i = read(fd, line, sizeof(line))) > 0) {
- write(fileno(stdout), line, i);
- }
- close(fd);
- return 0;
- }
- perror_msg_and_die("/proc/modules");
+ if(print_file_by_name("/proc/modules") == FALSE)
return 1;
+ return 0;
}
-#endif /*CONFIG_FEATURE_OLD_MODULE_INTERFACE*/
+#endif /* CONFIG_FEATURE_QUERY_MODULE_INTERFACE */