aboutsummaryrefslogtreecommitdiff
path: root/include (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
| * clang/llvm 9 fix - do not eliminate a store to a fake "const"Denys Vlasenko2019-10-251-1/+21
| | | | | | | | | | | | | | This is *much* better (9 kbytes better) than dropping "*const" optimization trick. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2019-08-161-4/+50
|\|
| * libbb: reduce the overhead of single parameter bb_error_msg() callsJames Byrne2019-07-021-1/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * mount,losetup: use /dev/loop-control is it existsDenys Vlasenko2019-06-091-3/+4
| | | | | | | | | | | | | | | | | | | | | | function old new delta get_free_loop - 58 +58 set_loop 597 649 +52 losetup_main 482 476 -6 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/1 up/down: 110/-6) Total: 104 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: move netlink socket binding to the utility functionDenys Vlasenko2019-06-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta create_and_bind_to_netlink - 134 +134 ifplugd_main 1117 1052 -65 uevent_main 399 306 -93 mdev_main 314 215 -99 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/3 up/down: 134/-257) Total: -123 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * losetup: Add partition scanning optionJack O'Sullivan2019-05-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Add -P option from util-linux losetup to scan for partitions. function old new delta losetup_main 449 482 +33 packed_usage 33264 33292 +28 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 61/0) Total: 61 bytes Signed-off-by: Jack O'Sullivan <jackos1998@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: allow nanosecond precision in file timesRon Yorston2019-08-161-16/+19
| | | | | | | | | | | | Modern Linux kernels use struct timespec to represent file times, thus allowing nanosecond precision. Update the WIN32 emulation of struct stat and stat(2) to do the same.
* | Merge branch 'busybox' into mergeRon Yorston2019-05-272-1/+15
|\|
| * libarchive: treat one "FIXME: avoid seek"Denys Vlasenko2019-05-242-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta xmalloc_read_with_initial_buf - 205 +205 setup_transformer_on_fd 154 150 -4 xmalloc_open_zipped_read_close 143 135 -8 xmalloc_read 201 10 -191 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/3 up/down: 205/-203) Total: 2 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Optionally re-introduce bb_info_msg()James Byrne2019-04-301-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Between Busybox 1.24.2 and 1.25.0 the bb_info_msg() function was eliminated and calls to it changed to be bb_error_msg(). The downside of this is that daemons now log all messages to syslog at the LOG_ERR level which makes it hard to filter errors from informational messages. This change optionally re-introduces bb_info_msg(), controlled by a new option FEATURE_SYSLOG_INFO, restores all the calls to bb_info_msg() that were removed (only in applets that set logmode to LOGMODE_SYSLOG or LOGMODE_BOTH), and also changes informational messages in ifplugd and ntpd. The code size change of this is as follows (using 'defconfig' on x86_64 with gcc 7.3.0-27ubuntu1~18.04) function old new delta bb_info_msg - 182 +182 bb_vinfo_msg - 27 +27 static.log7 194 198 +4 log8 190 191 +1 log5 190 191 +1 crondlog 45 - -45 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 3/0 up/down: 215/-45) Total: 170 bytes If you don't care about everything being logged at LOG_ERR level then when FEATURE_SYSLOG_INFO is disabled Busybox actually gets smaller: function old new delta static.log7 194 200 +6 log8 190 193 +3 log5 190 193 +3 syslog_level 1 - -1 bb_verror_msg 583 581 -2 crondlog 45 - -45 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 3/1 up/down: 12/-48) Total: -36 bytes Signed-off-by: James Byrne <james.byrne@origamienergy.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: try to make working directory names consistentRon Yorston2019-04-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Standardise the path names used for the current working directory by: - resolving with realpath(3); - making the drive name or host name uppercase. The first only really works for physical drives; results for mapped drives are patchy. The standardisation is applied in two places: - at the end of updatepwd() in ash; - when a symbolic link is resolved in mingw_chdir().
* | win32: fix compilation error; update default configurationsRon Yorston2019-03-311-0/+1
| |
* | Merge branch 'busybox' into mergeRon Yorston2019-03-311-1/+5
|\|
| * libbb: mark scripted_main() as externally visibleRon Yorston2019-03-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Building with individual binaries enabled fails when embedded script applets are included: /tmp/ccIvMFZg.o: In function `main': applet.c:(.text.main+0x20): undefined reference to `scripted_main' Mark scripted_main() as externally visible. Reported-by: Yann E. MORIN <yann.morin.1998@free.fr> Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * do not duplicate CONFIG_PID_FILE_PATH and ".pid" stringsDenys Vlasenko2019-03-171-0/+4
| | | | | | | | | | | | | | | | text data bss dec hex filename 981737 485 7296 989518 f194e busybox_old 981704 485 7296 989485 f192d busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: improved support for c:path path namesRon Yorston2019-03-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Microsoft Windows permits path names of the form 'c:path', without a path separator after the colon. The system records a current directory for each drive and the path is interpreted relative to that. Since Windows API calls understand 'c:path' path names many commands in busybox-w32 already work with them. This commit adds the following: - The 'cd' shell built-in interprets 'c:path' path names correctly. Previously it treated them as relative to the shell's concept of the current working directory, not the current directory of the specified drive. - The 'pwd' shell built-in takes the '-a' option to list the current directory for all drives. - 'c:path' path names are subject to tab-completion. Paths of the form 'c:path' don't work for mapped network drives or paths that have been associated with a drive using SUBST. See GitHub issue #147.
* | win32: interpret absolute paths as relative to %SYSTEMDRIVE%Ron Yorston2019-03-281-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BusyBox contains hardcoded references to absolute paths which are unique in the *nix world but on Microsoft Windows are interpreted as being on the current drive. To make these unique again consider them to be relative to %SYSTEMDRIVE%. Support this by adding functions to: - determine the system drive (not using the environment variable); - change a process's current directory to the root of the system drive; - make relative paths absolute before changing directory (if needed). The following applications have been modified: - ash references /etc/profile from the system drive; - dpkg places its data store on and installs files to the system drive; - rpm installs files to the system drive; - man looks for configuration files and man pages on the system drive. See GitHub issue #158.
* | win32: share code to find root prefix of pathRon Yorston2019-03-231-0/+3
| | | | | | | | | | | | | | Move unc_root_len() from ash to mingw32.c and use it in the new function root_len(), which can be used in make_directory(). This reduces changes to upstream code and saves a few bytes.
* | Merge branch 'busybox' into mergeRon Yorston2019-03-161-0/+2
|\|
| * watch: support fractional -n SECDenys Vlasenko2019-03-121-0/+2
| | | | | | | | | | | | | | function old new delta watch_main 212 232 +20 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: add function to convert slashes to backslashesRon Yorston2019-03-151-1/+2
| | | | | | | | | | | | | | | | | | There are now two places where slashes are converted to backslashes throughout a string so it makes sense to create a function to do this. To avoid confusion rename convert_slashes() to bs_to_slash() and call the new function slash_to_bs().
* | win32: changes to user idsRon Yorston2019-03-101-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Formalise the use of 0 as the uid of a process running with elevated privileges: - Rewrite getuid(2) to return DEFAULT_UID by default and 0 if the process has elevated privileges. - geteuid(2) and the corresponding functions for groups are aliases for getuid(2). - Change root's home directory to be whatever GetSystemDirectory() returns, probably C:/Windows/System32 in most cases. - Remove the special handling of geteuid(2) in the line editing code. With these changes the shell started by 'su' is a lot more like a *nix root shell.
* | su: change title of console windowRon Yorston2019-03-091-0/+1
| |
* | win32: add a function to detect running with elevated privilegesRon Yorston2019-03-091-0/+1
| | | | | | | | | | Add is_admin() and use it to alter the command prompt in the line editor when running with admin privileges.
* | win32: canonicalize path in chdir(2)Ron Yorston2019-03-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Provide an implementation of chdir(2) which canonicalizes the path to resolve symlinks. Otherwise changing to a symlinked directory confuses 'ls -l' because it thinks '.' is a link rather than a directory. OTOH, using 'cd' in the shell to change to a symlinked directory now results in a mismatch between the shell's idea of where we are and what's displayed in the prompt. But upstream BusyBox does that too so it must be OK.
* | win32: implement readlink(2)Ron Yorston2019-03-061-0/+4
| | | | | | | | | | | | | | | | | | | | Provide an implementation of readlink(2) based on code from Git for Windows. This version only supports symbolic links, not mount points, as the latter seem to work well enough as-is. With this change the ls and stat applets can display the targets of symbolic links. The readlink applet has been enabled in the default configuration.
* | win32: drop argument from err_win_to_posix()Ron Yorston2019-03-061-1/+1
| |
* | win32: let stat(2) report numeric uids for local usersRon Yorston2019-03-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | Further extend file identification so stat(2) returns the relative identifier as a numeric uid for files with owner SIDs that look like a local or domain user. See: https://blogs.technet.microsoft.com/markrussinovich/2009/11/03/the-machine-sid-duplication-myth-and-why-sysprep-matters/ https://cygwin.com/cygwin-ug-net/ntsec.html
* | ash: updated support for hiding consoleRon Yorston2019-02-171-0/+1
| | | | | | | | | | | | | | | | Move the code to hide the console to a separate function in win32/mingw.c. Use lazy loading to avoid problems on platforms where the require APIs aren't supported (PR #70). Enable console hiding in the default 64-bit configuration.
* | win32: make stat(2) fetch additional metadataRon Yorston2019-02-162-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Modify the WIN32 implementation of stat(2) to fetch inode number, device id and number of hardlinks. This requires opening a handle to the target file so it will be slower. A number of features can be enabled or start to work: - tar can detect if an archive is being stored in itself; - find can support the -inum and -links options; - ls can display inode numbers; - diff can detect attempts to compare a file with itself; - du has better support for hardlinked files; - cp can detect attempts to copy a file over itself.
* | win32: add a function to remove CRs from a text bufferRon Yorston2019-02-141-1/+2
| |
* | libarchive: remove more symlink codeRon Yorston2019-02-141-0/+3
| | | | | | | | | | | | | | Since symlinks aren't supported in busybox-w32 remove more of the code that handles them. Saves 64 bytes.
* | Merge branch 'busybox' into mergeRon Yorston2019-02-121-5/+5
|\|
| * start-stop-daemon: create pidfile before parent exits, closes 8596Denys Vlasenko2019-01-141-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes DAEMON_DOUBLE_FORK flag from bb_daemonize_or_rexec(), as SSD was the only user. Also includes fix for -S: now works without -a and -x, does not print pids (compat with "start-stop-daemon (OpenRC) 0.34.11 (Gentoo Linux)"). function old new delta start_stop_daemon_main 1018 1084 +66 add_interface 99 103 +4 fail_hunk 139 136 -3 bb_daemonize_or_rexec 205 183 -22 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/2 up/down: 70/-25) Total: 45 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: add support for the euro currency symbolRon Yorston2019-02-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The euro currency symbol was added to some OEM code pages. See: https://www.aivosto.com/articles/charsets-codepages-dos.html Add a configuration option (enabled by default) to support this. When enabled: - The read_key() function requests wide character key events. This allows the euro symbol to be entered regardless of the console OEM code page, though it needs to be available in the ANSI code page. - Conversions between OEM and ANSI code pages in winansi.c are modified to work around a bug in the Microsoft routines. - If the OEM code page is 850 when BusyBox starts it's changed to 858. This is the only currently supported OEM code page. Also, the shell read builtin is modified to use read_key() whenever input is being taken from the console.
* | Update default configuration; compilation fixRon Yorston2019-01-101-0/+16
| | | | | | | | | | Continue to use old version of dc; add definition of LONG_BIT from xopen_lim.h.
* | Merge branch 'busybox' into mergeRon Yorston2019-01-101-2/+9
|\|
| * pmap: make 32-bit version work better on 64-bit kernelsDenys Vlasenko2018-12-311-1/+6
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * inetd: suppress aliasing warningDenys Vlasenko2018-12-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta sigprocmask2 - 8 +8 wait_for_child_or_signal 213 218 +5 dowait 424 429 +5 block_CHLD_HUP_ALRM 62 59 -3 sigprocmask_SIG_SETMASK 16 - -16 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 2/1 up/down: 18/-19) Total: -1 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * suppress gcc 8 aliasing warningsDenys Vlasenko2018-12-081-0/+2
| | | | | | | | | | | | | | | | | | function old new delta sigprocmask_SIG_SETMASK - 16 +16 wait_for_child_or_signal 221 213 -8 dowait 432 424 -8 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * bc: unbreak FEATURE_CLEAN_UP buildDenys Vlasenko2018-12-061-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | ps: add support for the args columnRon Yorston2019-01-081-5/+2
| | | | | | | | | | | | | | | | | | Implement read_cmdline() for WIN32 by storing the command line in the same way as the applet name. The applet name is actually used for the comm column which is truncated to COMM_LEN. Using this as the size of the bb_comm array avoids the need to calculate MAX_APPLET_NAME_LEN.
* | win32: implement vsnprintf(2)Ron Yorston2019-01-081-0/+4
| | | | | | | | | | The Microsoft C runtime may include a defective version of vsnprintf. Implement a standards-compliant replacement.
* | win32: implement umask(2)Ron Yorston2019-01-071-0/+5
| | | | | | | | | | | | | | | | | | umask() in the Microsoft C runtime takes different arguments to umask(2). Implement a fake umask(2) that remembers the mask and calls the Microsoft umask() with an appropriate value. Since the mask won't be inherited by children use an environment variable to pass any value set by the shell built-in umask.
* | tar: return correct exit code for empty tar fileRon Yorston2019-01-061-0/+4
| | | | | | | | | | The WIN32 implementation of check_errors_in_children shouldn't have reset bb_got_signal as it's used to signal an error.
* | busybox: add --uninstall optionRon Yorston2019-01-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add an option to allow hard links to be removed. busybox --uninstall file removes all hard links to the given file (including the file itself.) Since Microsoft Windows refuses to delete a running executable a BusyBox binary is unable to remove links to itself. busybox --uninstall -n file displays the names of all hard links to the given file. Although this feature is couched in terms of uninstalling BusyBox it's actually quite general: it can be used to delete or display hard links to any file.
* | win32: special treatment for PATHRon Yorston2018-12-142-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The PATH shell variable is a special case. It can be exported to the environment where it might be interpreted by native applications which assume the separator is ';'. Hence: - require that the separator used in PATH is ';' - enforce this by intercepting calls to setvareq() that set PATH and adjusting its value if necessary. As a result of this the code to parse PATH can be simplified by replacing the hardcoded Unix ':' path separator by the platform- dependent macro PATH_SEP. The MANPATH variable is also required to use ';' as its separator but since it's less likely to be used this isn't enforced.
* | win32: emulate SIGPIPERon Yorston2018-12-112-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code to check whether a write error is due to a broken pipe can now either: - return with error EPIPE; - cause the process to exit with code 128+SIGPIPE. The default is the latter but the behaviour can be changed by issuing signal(SIGPIPE, SIG_IGN) and signal(SIGPIPE, SIG_DFL) calls. No actual signal is involved so kill can't send SIGPIPE and handlers other than SIG_IGN and SIG_DFL aren't supported. This does, however, avoid unsightly 'broken pipe' errors from commands like the example in GitHub issue #99: dd if=/dev/urandom | tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo;
* | win32: add a case-insensitive version of is_suffixed_with()Ron Yorston2018-12-091-0/+1
| |
* | lineedit: more case-insensitive comparisons in tab completionRon Yorston2018-12-081-0/+1
| |