Improve STANDALONE_SHELL. "safe" applets are renamed NOEXEC applets

and now this fact is recorded in applets.h, not ash.c.

Several fixes to "--help + STANDALONE_SHELL" scenarios.

function                                             old     new   delta
run_current_applet_and_exit                            -     355    +355
arith                                               2064    2073      +9
refresh                                             1148    1156      +8
getopt32                                            1068    1073      +5
telnet_main                                         1510    1514      +4
md5_sha1_sum_main                                    565     566      +1
xstrtoul_range_sfx                                   255     251      -4
packed_usage                                       22523   22514      -9
tryexec                                              255     203     -52
static.safe_applets                                  152       -    -152
.rodata                                           131320  131128    -192
run_applet_by_name                                   869     506    -363
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 5/5 up/down: 382/-772)         Total: -390 bytes

./busybox ash -c 'i=20000; while test $i != 0; do touch z; i=$((i-1)); done'
runs more than twice as fast with STANDALONE_SHELL versus without.
This commit is contained in:
Denis Vlasenko 2007-04-09 03:11:58 +00:00
parent 95cb3263ae
commit c44ab01b75
5 changed files with 65 additions and 93 deletions

View file

@ -662,9 +662,11 @@ const struct hwtype *get_hwntype(int type);
#ifndef BUILD_INDIVIDUAL
extern struct BB_applet *find_applet_by_name(const char *name);
struct BB_applet;
extern const struct BB_applet *find_applet_by_name(const char *name);
/* Returns only if applet is not found. */
extern void run_applet_by_name(const char *name, int argc, char **argv);
extern void run_current_applet_and_exit(int argc, char **argv) ATTRIBUTE_NORETURN;
#endif
extern int match_fstype(const struct mntent *mt, const char *fstypes);
@ -870,6 +872,7 @@ enum { /* DO NOT CHANGE THESE VALUES! cp.c, mv.c, install.c depend on them. */
};
#define FILEUTILS_CP_OPTSTR "pdRfils" USE_SELINUX("c")
extern const struct BB_applet *current_applet;
extern const char *applet_name;
extern const char BB_BANNER[];