aboutsummaryrefslogtreecommitdiff
path: root/include (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
| * randomconfig fixDenys Vlasenko2020-06-231-0/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * randomconfig fixesDenys Vlasenko2020-06-231-0/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: return raw file attributes in struct mingw_statRon Yorston2020-07-091-0/+1
| | | | | | | | | | | | Until now the emulated stat(2) system calls have only returned a synthesised Unix-style mode value. Also return the raw Windows file attributes.
* | win32: fix networking problemsRon Yorston2020-06-031-0/+1
| | | | | | | | | | | | | | | | | | The subprocess that handles incoming connections for httpd didn't work. It has an accepted connection on stdin and calls getpeername() to obtain its details, but getpeername() didn't initialise networking. ssl_client only seems to deal with file descriptors. Expose init_winsock() again and call it from ssl_client.
* | win32: only initialise networking if necessaryRon Yorston2020-06-011-1/+7
| | | | | | | | | | | | A call to initialise networking is made during start up even if the applet doesn't need it. Instead, only initialise networking when a call is made to a function that definitely requires it.
* | ash: simplify spawning during forkshellRon Yorston2020-06-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | spawn_forkshell() uses mingw_spawn_proc() to start the child shell. mingw_spawn_proc() then calls mingw_spawn_1() which determines that "sh" is an applet, thus calling mingw_spawn_applet() which finally calls spawnveq(). Not only is this convoluted it also won't work if PREFER_APPLETS and SH_STANDALONE aren't enabled. Simplify matters by adding a new function, mingw_spawn_forkshell(), which is tailored for just this case.
* | dd: fix handling of 'conv=notrunc seek=N'Ron Yorston2020-05-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit e6680912a (dd: create a sparse file when seek=N is used) broke the use of 'conv=notrunc seek=N' to modify existing files. Rename seek_sparse() to make_sparse() and: - add an argument to specify the start of the sparse region; - call make_sparse() before ftruncate(); - call make_sparse() only if: * we can determine the size of the file; * the file is not open in append mode; * the file is being extended. This should fix GitHub issue #186.
* | ash: reset ANSI emulation when BB_SKIP_ANSI_EMULATION changesRon Yorston2020-04-132-0/+2
| | | | | | | | | | Update the skip status on the first call to skip_ansi_emulation() and whenever the BB_SKIP_ANSI_EMULATION variable changes.
* | time: WIN32 portRon Yorston2020-04-061-1/+2
| | | | | | | | | | | | | | | | Port the time applet to WIN32. This requires the implemntation of a replacement for wait3(2). Only elapsed, user and system times are supported, not the memory and i/o statistics reported by GNU time.
* | win32: new functions: getpeername(2), mingw_spawn_detach()Ron Yorston2020-04-051-0/+3
| | | | | | | | | | | | | | Implement getpeername(2). Add mingw_spawn_detach() to allow the spawned process to detach from the console.
* | dd: create a sparse file when seek=N is usedRon Yorston2020-03-241-0/+1
| | | | | | | | | | | | | | When the seek=N argument is used mark the file as sparse and set the range that is sparse. See https://stackoverflow.com/questions/4011508/how-to-create-a-sparse-file-on-ntfs
* | Merge branch 'busybox' into mergeRon Yorston2020-02-181-0/+2
|\|
* | win32: tidy up detection of device filesRon Yorston2020-02-161-1/+1
| | | | | | | | | | | | | | Define NOT_DEVICE as -1 so the return value of index_in_strings() when no device name is matched is NOT_DEVICE. Make the logic in mingw_open() clearer.
* | Merge branch 'busybox' into mergeRon Yorston2020-02-151-0/+13
|\|
| * ash,hush: allow builtins to be tab-completed, closes 7532Ron Yorston2020-01-291-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta complete_cmd_dir_file 678 830 +152 get_builtin_name - 35 +35 optschanged 125 132 +7 hush_main 1069 1076 +7 save_command_ps_at_cur_history 76 78 +2 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 4/0 up/down: 203/0) Total: 203 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: code shrinkRon Yorston2020-02-131-1/+1
| | | | | | | | | | Have bs_to_slash() return a pointer to its argument. This allows some calls to be chained, saving 32 bytes.
* | date: code shrinkRon Yorston2020-02-111-1/+0
| | | | | | | | | | | | | | Since we don't have a working clock_settime(2) there's no point in claiming to support the '-s' option. Saves 96 bytes
* | Build fixesFRP-3329-gcf0fa4d13Ron Yorston2020-01-081-1/+1
| | | | | | | | | | | | - Update configuration files - Omit unnecessary libraries - Replace fake stime(2) with fake clock_settime(2)
* | Merge branch 'busybox' into mergeRon Yorston2020-01-081-1/+21
|\|
| * 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
| |