610c4c385b
The array applet_nameofs consumes two bytes per applet. It encodes nofork/noexec flags suid flags the offset of the applet name in the applet_name string Change the applet_table build tool to store the flags in two separate arrays (applet_flags and applet_suid). Replace applet_nameofs[] with a smaller version that only stores a limited number of offsets. This requires changes to the macros APPLET_IS_NOFORK, APPLET_IS_NOEXEC and APPLET_SUID. According to Valgrind the original find_applet_by_name required 353 cycles per call, averaged over all names. Adjusting the number of known offsets allows space to be traded off against execution time: KNOWN_OFFSETS cycles bytes (wrt KNOWN_OFFSETS = 0) 0 9057 - 2 4604 32 4 2407 75 8 1342 98 16 908 130 32 884 194 This patch uses KNOWN_OFFSETS = 8. v2: Remove some dead code from the applet_table tool; Treat the applet in the middle of the table as a special case. v3: Use the middle applet to adjust the start of the linear search as well as the last applet found. v4: Use an augmented linear search in find_applet_by_name. Drop the special treatment of the middle name from get_applet_name: most of the advantage now derives from the last stored value. v5: Don't store index in applet_nameofs, it can be calculated. v6: Tweaks by Denys function old new delta find_applet_by_name 25 125 +100 applet_suid - 92 +92 run_applet_no_and_exit 452 460 +8 run_applet_and_exit 695 697 +2 applet_name_compare 31 - -31 applet_nameofs 734 14 -720 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 3/1 up/down: 202/-751) Total: -549 bytes text data bss dec hex filename 925464 906 17160 943530 e65aa busybox_old 924915 906 17160 942981 e6385 busybox_unstripped Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com> |
||
---|---|---|
.. | ||
appletlib.c | ||
ask_confirmation.c | ||
auto_string.c | ||
bb_askpass.c | ||
bb_bswap_64.c | ||
bb_do_delay.c | ||
bb_pwd.c | ||
bb_qsort.c | ||
bb_strtod.c | ||
bb_strtonum.c | ||
bbunit.c | ||
change_identity.c | ||
chomp.c | ||
compare_string_array.c | ||
concat_path_file.c | ||
concat_subpath_file.c | ||
Config.src | ||
copy_file.c | ||
copyfd.c | ||
correct_password.c | ||
crc32.c | ||
default_error_retval.c | ||
device_open.c | ||
die_if_bad_username.c | ||
dump.c | ||
endofname.c | ||
executable.c | ||
fclose_nonstdin.c | ||
fflush_stdout_and_exit.c | ||
fgets_str.c | ||
find_mount_point.c | ||
find_pid_by_name.c | ||
find_root_device.c | ||
full_write.c | ||
get_console.c | ||
get_cpu_count.c | ||
get_last_path_component.c | ||
get_line_from_file.c | ||
get_shell_name.c | ||
get_volsize.c | ||
getopt32.c | ||
getpty.c | ||
hash_md5_sha.c | ||
hash_md5prime.c | ||
herror_msg.c | ||
human_readable.c | ||
in_ether.c | ||
inet_cksum.c | ||
inet_common.c | ||
info_msg.c | ||
inode_hash.c | ||
isdirectory.c | ||
Kbuild.src | ||
kernel_version.c | ||
last_char_is.c | ||
lineedit_ptr_hack.c | ||
lineedit.c | ||
llist.c | ||
logenv.c | ||
login.c | ||
loop.c | ||
make_directory.c | ||
makedev.c | ||
match_fstype.c | ||
messages.c | ||
missing_syscalls.c | ||
mode_string.c | ||
mtab.c | ||
nuke_str.c | ||
obscure.c | ||
parse_config.c | ||
parse_mode.c | ||
percent_decode.c | ||
perror_msg.c | ||
perror_nomsg_and_die.c | ||
perror_nomsg.c | ||
pidfile.c | ||
platform.c | ||
print_flags.c | ||
printable_string.c | ||
printable.c | ||
process_escape_sequence.c | ||
procps.c | ||
progress.c | ||
ptr_to_globals.c | ||
pw_encrypt_des.c | ||
pw_encrypt_md5.c | ||
pw_encrypt_sha.c | ||
pw_encrypt.c | ||
read_key.c | ||
read_printf.c | ||
read.c | ||
README | ||
recursive_action.c | ||
remove_file.c | ||
replace.c | ||
rtc.c | ||
run_shell.c | ||
safe_gethostname.c | ||
safe_poll.c | ||
safe_strncpy.c | ||
safe_write.c | ||
selinux_common.c | ||
setup_environment.c | ||
signals.c | ||
simplify_path.c | ||
single_argv.c | ||
skip_whitespace.c | ||
speed_table.c | ||
str_tolower.c | ||
strrstr.c | ||
sysconf.c | ||
time.c | ||
trim.c | ||
u_signal_names.c | ||
udp_io.c | ||
unicode.c | ||
update_passwd.c | ||
utmp.c | ||
uuencode.c | ||
vdprintf.c | ||
verror_msg.c | ||
vfork_daemon_rexec.c | ||
warn_ignoring_args.c | ||
wfopen_input.c | ||
wfopen.c | ||
write.c | ||
xatonum_template.c | ||
xatonum.c | ||
xconnect.c | ||
xfunc_die.c | ||
xfuncs_printf.c | ||
xfuncs.c | ||
xgetcwd.c | ||
xgethostbyname.c | ||
xreadlink.c | ||
xrealloc_vector.c | ||
xregcomp.c |
Please see the LICENSE file for copyright information (GPLv2) libbb is BusyBox's utility library. All of this stuff used to be stuffed into a single file named utility.c. When I split utility.c to create libbb, some of the very oldest stuff ended up without their original copyright and licensing information (which is now lost in the mists of time). If you see something that you wrote that is mis-attributed, do let me know so we can fix that up. Erik Andersen <andersen@codepoet.org>