aboutsummaryrefslogtreecommitdiff
path: root/modutils
diff options
context:
space:
mode:
Diffstat (limited to 'modutils')
-rw-r--r--modutils/insmod.c2
-rw-r--r--modutils/lsmod.c2
-rw-r--r--modutils/modinfo.c5
-rw-r--r--modutils/modprobe-small.c18
-rw-r--r--modutils/modprobe.c11
-rw-r--r--modutils/modutils-24.c4
-rw-r--r--modutils/rmmod.c2
7 files changed, 23 insertions, 21 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c
index b8ede8a81..4dc0b6608 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -13,7 +13,7 @@
13//config: help 13//config: help
14//config: insmod is used to load specified modules in the running kernel. 14//config: insmod is used to load specified modules in the running kernel.
15 15
16//applet:IF_INSMOD(IF_NOT_MODPROBE_SMALL(APPLET(insmod, BB_DIR_SBIN, BB_SUID_DROP))) 16//applet:IF_INSMOD(IF_NOT_MODPROBE_SMALL(APPLET_NOEXEC(insmod, insmod, BB_DIR_SBIN, BB_SUID_DROP, insmod)))
17 17
18//kbuild:ifneq ($(CONFIG_MODPROBE_SMALL),y) 18//kbuild:ifneq ($(CONFIG_MODPROBE_SMALL),y)
19//kbuild:lib-$(CONFIG_INSMOD) += insmod.o modutils.o 19//kbuild:lib-$(CONFIG_INSMOD) += insmod.o modutils.o
diff --git a/modutils/lsmod.c b/modutils/lsmod.c
index 4bf8f8481..84860cd79 100644
--- a/modutils/lsmod.c
+++ b/modutils/lsmod.c
@@ -23,7 +23,7 @@
23//config: the format of module-init-tools for Linux kernel 2.6. 23//config: the format of module-init-tools for Linux kernel 2.6.
24//config: Increases size somewhat. 24//config: Increases size somewhat.
25 25
26//applet:IF_LSMOD(IF_NOT_MODPROBE_SMALL(APPLET(lsmod, BB_DIR_SBIN, BB_SUID_DROP))) 26//applet:IF_LSMOD(IF_NOT_MODPROBE_SMALL(APPLET_NOEXEC(lsmod, lsmod, BB_DIR_SBIN, BB_SUID_DROP, lsmod)))
27 27
28//kbuild:ifneq ($(CONFIG_MODPROBE_SMALL),y) 28//kbuild:ifneq ($(CONFIG_MODPROBE_SMALL),y)
29//kbuild:lib-$(CONFIG_LSMOD) += lsmod.o modutils.o 29//kbuild:lib-$(CONFIG_LSMOD) += lsmod.o modutils.o
diff --git a/modutils/modinfo.c b/modutils/modinfo.c
index 371c93991..3f91622a9 100644
--- a/modutils/modinfo.c
+++ b/modutils/modinfo.c
@@ -12,7 +12,7 @@
12//config: help 12//config: help
13//config: Show information about a Linux Kernel module 13//config: Show information about a Linux Kernel module
14 14
15//applet:IF_MODINFO(APPLET(modinfo, BB_DIR_SBIN, BB_SUID_DROP)) 15//applet:IF_MODINFO(APPLET_NOEXEC(modinfo, modinfo, BB_DIR_SBIN, BB_SUID_DROP, modinfo))
16 16
17//kbuild:lib-$(CONFIG_MODINFO) += modinfo.o modutils.o 17//kbuild:lib-$(CONFIG_MODINFO) += modinfo.o modutils.o
18 18
@@ -148,8 +148,7 @@ int modinfo_main(int argc UNUSED_PARAM, char **argv)
148 unsigned i; 148 unsigned i;
149 149
150 field = NULL; 150 field = NULL;
151 opt_complementary = "-1"; /* minimum one param */ 151 opts = getopt32(argv, "^" "0F:nadlp" "\0" "-1"/*minimum one arg*/, &field);
152 opts = getopt32(argv, "0F:nadlp", &field);
153 /* If no field selected, show all */ 152 /* If no field selected, show all */
154 if (!(opts & (OPT_TAGS|OPT_F))) 153 if (!(opts & (OPT_TAGS|OPT_F)))
155 option_mask32 |= OPT_TAGS; 154 option_mask32 |= OPT_TAGS;
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c
index 053a7df89..a94b0b9a6 100644
--- a/modutils/modprobe-small.c
+++ b/modutils/modprobe-small.c
@@ -11,12 +11,15 @@
11/* modprobe-small configs are defined in Config.src to ensure better 11/* modprobe-small configs are defined in Config.src to ensure better
12 * "make config" order */ 12 * "make config" order */
13 13
14//applet:IF_LSMOD( IF_MODPROBE_SMALL(APPLET(lsmod, BB_DIR_SBIN, BB_SUID_DROP))) 14//applet:IF_LSMOD( IF_MODPROBE_SMALL(APPLET_NOEXEC( lsmod, lsmod, BB_DIR_SBIN, BB_SUID_DROP, lsmod )))
15//applet:IF_MODPROBE(IF_MODPROBE_SMALL(APPLET(modprobe, BB_DIR_SBIN, BB_SUID_DROP))) 15//applet:IF_MODPROBE(IF_MODPROBE_SMALL(APPLET_NOEXEC( modprobe, modprobe, BB_DIR_SBIN, BB_SUID_DROP, modprobe)))
16// APPLET_ODDNAME:name main location suid_type help 16// APPLET_ODDNAME:name main location suid_type help
17//applet:IF_DEPMOD(IF_MODPROBE_SMALL(APPLET_ODDNAME(depmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, depmod))) 17//applet:IF_DEPMOD( IF_MODPROBE_SMALL(APPLET_ODDNAME(depmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, depmod )))
18//applet:IF_INSMOD(IF_MODPROBE_SMALL(APPLET_ODDNAME(insmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, insmod))) 18//applet:IF_INSMOD( IF_MODPROBE_SMALL(APPLET_NOEXEC( insmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, insmod )))
19//applet:IF_RMMOD( IF_MODPROBE_SMALL(APPLET_ODDNAME(rmmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, rmmod))) 19//applet:IF_RMMOD( IF_MODPROBE_SMALL(APPLET_NOEXEC( rmmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, rmmod )))
20/* noexec speeds up boot with many modules loaded (need SH_STANDALONE=y) */
21/* I measured about ~5 times faster insmod */
22/* depmod is not noexec, it runs longer and benefits from memory trimming via exec */
20 23
21//kbuild:lib-$(CONFIG_MODPROBE_SMALL) += modprobe-small.o 24//kbuild:lib-$(CONFIG_MODPROBE_SMALL) += modprobe-small.o
22 25
@@ -985,10 +988,9 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
985 988
986#if ENABLE_MODPROBE || ENABLE_INSMOD || ENABLE_RMMOD 989#if ENABLE_MODPROBE || ENABLE_INSMOD || ENABLE_RMMOD
987 /* modprobe, insmod, rmmod require at least one argument */ 990 /* modprobe, insmod, rmmod require at least one argument */
988 opt_complementary = "-1";
989 /* only -q (quiet) and -r (rmmod), 991 /* only -q (quiet) and -r (rmmod),
990 * the rest are accepted and ignored (compat) */ 992 * the rest are accepted and ignored (compat) */
991 getopt32(argv, "qrfsvwb"); 993 getopt32(argv, "^" "qrfsvwb" "\0" "-1");
992 argv += optind; 994 argv += optind;
993 995
994 if (is_modprobe) { 996 if (is_modprobe) {
diff --git a/modutils/modprobe.c b/modutils/modprobe.c
index 1a7db09f2..59f6d54f3 100644
--- a/modutils/modprobe.c
+++ b/modutils/modprobe.c
@@ -26,7 +26,7 @@
26//config: hardware autodetection scripts to load modules like evdev, frame 26//config: hardware autodetection scripts to load modules like evdev, frame
27//config: buffer drivers etc. 27//config: buffer drivers etc.
28 28
29//applet:IF_MODPROBE(IF_NOT_MODPROBE_SMALL(APPLET(modprobe, BB_DIR_SBIN, BB_SUID_DROP))) 29//applet:IF_MODPROBE(IF_NOT_MODPROBE_SMALL(APPLET_NOEXEC(modprobe, modprobe, BB_DIR_SBIN, BB_SUID_DROP, modprobe)))
30 30
31//kbuild:ifneq ($(CONFIG_MODPROBE_SMALL),y) 31//kbuild:ifneq ($(CONFIG_MODPROBE_SMALL),y)
32//kbuild:lib-$(CONFIG_MODPROBE) += modprobe.o modutils.o 32//kbuild:lib-$(CONFIG_MODPROBE) += modprobe.o modutils.o
@@ -133,7 +133,7 @@
133 */ 133 */
134#define MODPROBE_OPTS "alrDb" 134#define MODPROBE_OPTS "alrDb"
135/* -a and -D _are_ in fact compatible */ 135/* -a and -D _are_ in fact compatible */
136#define MODPROBE_COMPLEMENTARY ("q-v:v-q:l--arD:r--alD:a--lr:D--rl") 136#define MODPROBE_COMPLEMENTARY "q-v:v-q:l--arD:r--alD:a--lr:D--rl"
137//#define MODPROBE_OPTS "acd:lnrt:C:b" 137//#define MODPROBE_OPTS "acd:lnrt:C:b"
138//#define MODPROBE_COMPLEMENTARY "q-v:v-q:l--acr:a--lr:r--al" 138//#define MODPROBE_COMPLEMENTARY "q-v:v-q:l--acr:a--lr:r--al"
139enum { 139enum {
@@ -566,9 +566,10 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
566 566
567 INIT_G(); 567 INIT_G();
568 568
569 IF_LONG_OPTS(applet_long_options = modprobe_longopts;) 569 opt = getopt32long(argv, "^" INSMOD_OPTS MODPROBE_OPTS "\0" MODPROBE_COMPLEMENTARY,
570 opt_complementary = MODPROBE_COMPLEMENTARY; 570 modprobe_longopts
571 opt = getopt32(argv, INSMOD_OPTS MODPROBE_OPTS INSMOD_ARGS); 571 INSMOD_ARGS
572 );
572 argv += optind; 573 argv += optind;
573 574
574 /* Goto modules location */ 575 /* Goto modules location */
diff --git a/modutils/modutils-24.c b/modutils/modutils-24.c
index 9ce91351d..1a30dd87c 100644
--- a/modutils/modutils-24.c
+++ b/modutils/modutils-24.c
@@ -2269,8 +2269,8 @@ static int add_symbols_from(struct obj_file *f,
2269 2269
2270#ifdef SYMBOL_PREFIX 2270#ifdef SYMBOL_PREFIX
2271 /* Prepend SYMBOL_PREFIX to the symbol's name (the 2271 /* Prepend SYMBOL_PREFIX to the symbol's name (the
2272 kernel exports `C names', but module object files 2272 kernel exports 'C names', but module object files
2273 reference `linker names'). */ 2273 reference 'linker names'). */
2274 size_t extra = sizeof SYMBOL_PREFIX; 2274 size_t extra = sizeof SYMBOL_PREFIX;
2275 size_t name_size = strlen(name) + extra; 2275 size_t name_size = strlen(name) + extra;
2276 if (name_size > name_alloced_size) { 2276 if (name_size > name_alloced_size) {
diff --git a/modutils/rmmod.c b/modutils/rmmod.c
index d60e49413..df50e58af 100644
--- a/modutils/rmmod.c
+++ b/modutils/rmmod.c
@@ -14,7 +14,7 @@
14//config: help 14//config: help
15//config: rmmod is used to unload specified modules from the kernel. 15//config: rmmod is used to unload specified modules from the kernel.
16 16
17//applet:IF_RMMOD(IF_NOT_MODPROBE_SMALL(APPLET(rmmod, BB_DIR_SBIN, BB_SUID_DROP))) 17//applet:IF_RMMOD(IF_NOT_MODPROBE_SMALL(APPLET_NOEXEC(rmmod, rmmod, BB_DIR_SBIN, BB_SUID_DROP, rmmod)))
18 18
19//kbuild:ifneq ($(CONFIG_MODPROBE_SMALL),y) 19//kbuild:ifneq ($(CONFIG_MODPROBE_SMALL),y)
20//kbuild:lib-$(CONFIG_RMMOD) += rmmod.o modutils.o 20//kbuild:lib-$(CONFIG_RMMOD) += rmmod.o modutils.o