aboutsummaryrefslogtreecommitdiff
path: root/libbb/get_console.c
AgeCommit message (Collapse)Author
2019-07-02libbb: reduce the overhead of single parameter bb_error_msg() callsJames Byrne
Back in 2007, commit 0c97c9d43707 ("'simple' error message functions by Loic Grenie") introduced bb_simple_perror_msg() to allow for a lower overhead call to bb_perror_msg() when only a string was being printed with no parameters. This saves space for some CPU architectures because it avoids the overhead of a call to a variadic function. However there has never been a simple version of bb_error_msg(), and since 2007 many new calls to bb_perror_msg() have been added that only take a single parameter and so could have been using bb_simple_perror_message(). This changeset introduces 'simple' versions of bb_info_msg(), bb_error_msg(), bb_error_msg_and_die(), bb_herror_msg() and bb_herror_msg_and_die(), and replaces all calls that only take a single parameter, or use something like ("%s", arg), with calls to the corresponding 'simple' version. Since it is likely that single parameter calls to the variadic functions may be accidentally reintroduced in the future a new debugging config option WARN_SIMPLE_MSG has been introduced. This uses some macro magic which will cause any such calls to generate a warning, but this is turned off by default to avoid use of the unpleasant macros in normal circumstances. This is a large changeset due to the number of calls that have been replaced. The only files that contain changes other than simple substitution of function calls are libbb.h, libbb/herror_msg.c, libbb/verror_msg.c and libbb/xfuncs_printf.c. In miscutils/devfsd.c, networking/udhcp/common.h and util-linux/mdev.c additonal macros have been added for logging so that single parameter and multiple parameter logging variants exist. The amount of space saved varies considerably by architecture, and was found to be as follows (for 'defconfig' using GCC 7.4): Arm: -92 bytes MIPS: -52 bytes PPC: -1836 bytes x86_64: -938 bytes Note that for the MIPS architecture only an exception had to be made disabling the 'simple' calls for 'udhcp' (in networking/udhcp/common.h) because it made these files larger on MIPS. Signed-off-by: James Byrne <james.byrne@origamienergy.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-10-05whitespace and comment format fixes, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-06kbd_mode: try harder to find console device if -C TTY is not givenDenys Vlasenko
Was (under X): $ ./busybox_old kbd_mode kbd_mode: ioctl 0x4b44 failed: Inappropriate ioctl for device Now: $ ./busybox kbd_mode The keyboard is in off mode function old new delta kbd_mode_main 166 174 +8 packed_usage 31782 31764 -18 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 8/-18) Total: -10 bytes text data bss dec hex filename 915757 485 6880 923122 e15f2 busybox_old 915747 485 6880 923112 e15e8 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16*: make GNU licensing statement forms more regularDenys Vlasenko
This change retains "or later" state! No licensing _changes_ here, only form is adjusted (article, space between "GPL" and "v2" and so on). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2008-11-05*: code shrink by adding a wrapper around very common tcsetattr(0, TCSANOW, ↵Denis Vlasenko
xx) op function old new delta tcsetattr_stdin_TCSANOW - 14 +14 set_sane_term 116 113 -3 top_main 1277 1273 -4 make_new_session 421 415 -6 rawmode 133 126 -7 reset_term 18 10 -8 die 43 35 -8 cookmode 62 54 -8 vlock_main 425 415 -10 read_line_input 3165 3155 -10 bb_askpass 357 347 -10 fsck_minix_main 3079 3065 -14 getty_main 2375 2332 -43 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/12 up/down: 14/-131) Total: -117 bytes
2008-08-05*: use get_console_fd() as appropriate, and make it fail on open error -Denis Vlasenko
get_console_fd_or_die(). function old new delta get_console_fd_or_die - 163 +163 loadkmap_main 211 201 -10 loadfont_main 440 430 -10 dumpkmap_main 218 208 -10 kbd_mode_main 158 146 -12 setkeycodes_main 156 143 -13 get_console_fd 163 - -163 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 0/5 up/down: 163/-218) Total: -55 bytes
2008-06-27*: introduce and use FAST_FUNC: regparm on i386, otherwise no-onDenis Vlasenko
text data bss dec hex filename 808035 611 6868 815514 c719a busybox_old 804472 611 6868 811951 c63af busybox_unstripped
2008-05-19- Rename getpty() to xgetpty() and adjust callers.Bernhard Reutner-Fischer
- Rewrite kbd_mode and setconsole - Introduce and use console_make_active() and xopen_xwrite_close() - honour buffer-reservation method as set by the user (dumpkmap, loadkmap) - shrink rtcwake and some console-tools Saves about 270 Bytes
2007-10-20kbd_mode: new applet by Loïc Grenié <loic.grenie@gmail.com>Denis Vlasenko
kbd_mode_main - 189 +189 packed_usage 22745 22833 +88 applets 3132 3144 +12 static.opts 7 12 +5 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 3/0 up/down: 294/0) Total: 294 bytes text data bss dec hex filename 777210 1000 9532 787742 c051e busybox_old 777575 1000 9532 788107 c068b busybox_unstripped
2007-05-31delete tons of extra #includesDenis Vlasenko
2007-04-12style fixes. No code changesDenis Vlasenko
2007-02-17init: code readability enhancements; very small code changesDenis Vlasenko
2007-02-03suppress warnings about easch <applet>_main() havingDenis Vlasenko
no preceding prototype
2006-09-29Yet another silly little byte saving. couldn't -> cannotDenis Vlasenko
2006-05-19- remove emacs layout block as suggested by Robert P.J. DayBernhard Reutner-Fischer
- use shorter boilerplate while at it
2006-03-10Patch from Denis Vlasenko turning static const int (which gets emitted intoRob Landley
the busybox binary) into enums (which don't).
2004-03-15Remove trailing whitespace. Update copyright to include 2004.Eric Andersen
2003-09-01Fix compile error and reducing size for libbb/get_console.c to previous size.Glenn L McGrath
Vodz last_patch106
2003-08-29Remove some unwanted code, patch from Holger Schurig, confirmed by vodzGlenn L McGrath
2003-07-14Update a bunch of docs. Run a script to update my email addr.Eric Andersen
2003-03-19Major coreutils update.Manuel Novoa III
2002-09-16Apply vodz' last_patch52Eric Andersen
2001-10-24Major rework of the directory structure and the entire build system.Eric Andersen
-Erik
2001-07-23Add support for devfs device names.Matt Kraai
2001-03-16Convert utility.c into libbb.a. It is now a whole pile of .cEric Andersen
files. Clean up the resulting damage and fix up the makefile. -Erik