aboutsummaryrefslogtreecommitdiff
path: root/include/platform.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* *: slap on a few ALIGN* where appropriateDenys Vlasenko2022-02-061-0/+1
| | | | | | | | | | | | | | The result of looking at "grep -F -B2 '*fill*' busybox_unstripped.map" function old new delta .rodata 108586 108460 -126 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-126) Total: -126 bytes text data bss dec hex filename 970412 4219 1848 976479 ee65f busybox_old 970286 4219 1848 976353 ee5e1 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* tls: P256: 64-bit optimizationsDenys Vlasenko2021-11-271-0/+2
| | | | | | | | | | | | function old new delta sp_256_proj_point_dbl_8 421 428 +7 sp_256_point_from_bin2x32 78 84 +6 sp_256_cmp_8 38 42 +4 sp_256_to_bin_8 28 31 +3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/0 up/down: 20/0) Total: 20 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: add process substitution in bash-compatibility modeRon Yorston2021-06-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Process substitution is a Korn shell feature that's also available in bash and some other shells. This patch implements process substitution in ash when ASH_BASH_COMPAT is enabled. function old new delta argstr 1386 1522 +136 strtodest - 52 +52 readtoken1 3346 3392 +46 .rodata 183206 183250 +44 unwindredir - 28 +28 cmdloop 365 372 +7 static.spclchars 10 12 +2 cmdputs 380 367 -13 exitreset 86 69 -17 evalcommand 1754 1737 -17 varvalue 675 634 -41 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 5/4 up/down: 315/-88) Total: 227 bytes text data bss dec hex filename 953967 4219 1904 960090 ea65a busybox_old 954192 4219 1904 960315 ea73b busybox_unstripped v2: Replace array of file descriptors with a linked list. Include tests that were unaccountably omitted from v1. v3: Update linked list code to the intended version. v4: Change order of conditional code in cmdputs(). v5: Use existing popredir() mechanism to manage file descriptors. v6: Rebase to latest version of BusyBox ash. Reduce code churn. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb.h: inline byteswapsDenys Vlasenko2021-04-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta recv_and_process_peer_pkt 2173 2245 +72 machtime_dg 97 114 +17 machtime_stream 29 45 +16 fmt_time_bernstein_25 132 139 +7 aesgcm_GHASH 183 184 +1 dumpleases_main 519 516 -3 __bswap_32 3 - -3 udhcp_run_script 743 739 -4 tls_xread_record 634 630 -4 select_lease_time 56 52 -4 rdate_main 260 256 -4 get_prefix 327 323 -4 udhcp_listen_socket 185 180 -5 sha1_process_block64 361 356 -5 sendping6 81 76 -5 sendping4 107 102 -5 read32 27 22 -5 ll_proto_a2n 112 107 -5 bb_lookup_port 102 97 -5 udhcpc_main 2615 2609 -6 tftpd_main 579 573 -6 str2sockaddr 558 552 -6 GMULT 136 130 -6 sha1_end 73 66 -7 ntpd_main 1361 1354 -7 ntohl 7 - -7 inet_addr_match 93 86 -7 htonl 7 - -7 do_iplink 1259 1252 -7 do_add_or_delete 1138 1131 -7 create_and_bind_or_die 117 110 -7 bind_for_passive_mode 124 117 -7 xconnect_ftpdata 98 90 -8 rpm_getint 118 110 -8 read_leases 304 296 -8 read_config 216 208 -8 udhcp_send_kernel_packet 336 327 -9 udhcp_recv_kernel_packet 143 134 -9 sha256_process_block64 451 442 -9 d6_send_kernel_packet_from_client_data_ifindex 275 266 -9 write_leases 215 205 -10 wget_main 2518 2508 -10 udhcpd_main 1528 1518 -10 tftp_protocol 2019 2009 -10 ftpd_main 2159 2149 -10 des_crypt 1318 1308 -10 send_ACK 138 127 -11 ipaddr_modify 1618 1607 -11 udhcp_str2optset 650 638 -12 init_d6_packet 115 103 -12 xwrite_encrypted 512 499 -13 tls_handshake 2060 2047 -13 pscan_main 607 594 -13 perform_d6_release 240 227 -13 ip_port_str 135 122 -13 handle_incoming_and_exit 2230 2217 -13 INET_setroute 751 737 -14 traceroute_init 1153 1137 -16 nc_main 1055 1039 -16 udhcp_init_header 92 75 -17 volume_id_probe_hfs_hfsplus 512 494 -18 send_offer 455 435 -20 do_lzo_decompress 507 487 -20 add_client_options 229 209 -20 ipcalc_main 554 533 -21 dhcprelay_main 966 943 -23 change_listen_mode 345 321 -24 send_packet 188 162 -26 static.xmalloc_optname_optval 709 681 -28 rpm_gettags 447 419 -28 machtime 28 - -28 catcher 299 270 -29 sfp_to_d 78 48 -30 reread_config_file 917 886 -31 lfp_to_d 84 51 -33 udhcp_recv_raw_packet 594 559 -35 nbdclient_main 1182 1145 -37 d_to_lfp 137 100 -37 lzo_compress 567 529 -38 d6_recv_raw_packet 299 254 -45 d_to_sfp 133 85 -48 d6_send_raw_packet_from_client_data_ifindex 427 379 -48 common_ping_main 1935 1887 -48 udhcp_send_raw_packet 467 416 -51 zcip_main 1219 1160 -59 udhcpc6_main 2636 2568 -68 do_lzo_compress 327 258 -69 send_arp_request 201 129 -72 common_traceroute_main 1699 1621 -78 arpping 523 437 -86 arping_main 1597 1481 -116 print_tunnel 678 550 -128 dnsd_main 1304 1164 -140 parse_args 1370 1169 -201 ------------------------------------------------------------------------------ (add/remove: 0/6 grow/shrink: 5/85 up/down: 113/-2246) Total: -2133 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* platform.h: fix for Bionic >= 21 not having wait3()Denys Vlasenko2021-04-141-0/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: placate -Werror=format-securityDenys Vlasenko2021-02-181-0/+8
| | | | | | | | | | "In function 'sprint_status48': error: format not a string literal and no format arguments" function old new delta sprint_status48 160 158 -2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Fix bb_setpgrp weapper on the FreeBSDAlex Samorukov2021-01-041-1/+1
| | | | | | | | FreeBSD uses setpgrp(pid_t, pid_t) This patch makes crond.c and probably others compilable Signed-off-by: Alex Samorukov <samm@os2.kiev.ua> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* decrease paddign: gcc-9.3.1 slaps 32-byte alignment on arrays willy-nillyDenys Vlasenko2020-11-301-0/+2
| | | | | | | | text data bss dec hex filename 1021988 559 5052 1027599 fae0f busybox_old 1021236 559 5052 1026847 fab1f busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* randomconfig fixDenys Vlasenko2020-06-231-0/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* tls: code shrinkDenys Vlasenko2018-11-231-0/+5
| | | | | | | function old new delta xwrite_encrypted 599 585 -14 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Hopefully fix "will break strict-aliasing rules" warning for get_le32Denys Vlasenko2017-08-101-0/+5
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: support platforms that don't have '%m' printf specifierRon Yorston2017-07-281-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The '%m' conversion specifier prints an error message based on the current value of 'errno'. It is available in the GNU C library, Cygwin (since 2012), uClibc and musl. It is not available in various BSDs, BSD-derived systems (MacOS, Android) or Microsoft Windows. Use a symbol defined in platform.h to control how error messages can be formatted to display the 'errno' message. On platforms that support it use '%m'; on other platforms use '%s' and strerror(). On platforms that have '%m' there is essentially no change in the size of the binary. Otherwise: function old new delta redirect 1287 1310 +23 xtcsetpgrp 27 44 +17 dup2_or_raise 34 51 +17 setinputfile 267 275 +8 .rodata 163379 163371 -8 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/1 up/down: 65/-8) Total: 57 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: less hackish implementation of evaltreenr()Denys Vlasenko2017-07-281-0/+7
| | | | | | | | | | | | | | | | | | | | | Defining a function alias with __attribute__ ((alias("evaltree"),__noreturn__)) is not that usual, and clang had a bug which made it misunderstand this construct. Switch to: ALWAYS_INLINE NORETURN evaltreenr() { evaltree(); unreachable(); } Older gcc's do not know unreachable(), on them we pay the price of having a few extra calls to abort(): function old new delta evalsubshell 151 156 +5 evalpipe 357 362 +5 argstr 1141 1144 +3 On newer gcc, code size does not change. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Move get_unaligned_le32() macros to platform.hDenys Vlasenko2017-07-151-0/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Allow FAST_FUNC to be overridden at build timeKang-Che Sung2017-01-091-5/+10
| | | | | | | | | | | | | | | | Busybox uses FAST_FUNC macro to tweak with IA-32 calling conventions in order to make the function call slightly smaller or slightly faster. However, when I experiment with GCC's LTO (Link Time Optimization), I discovered that FAST_FUNC could hinder LTO's optimization so that the resulting executable become a few bytes larger (than what is compiled without FAST_FUNC). This change allows to specify e.g. CONFIG_EXTRA_CFLAGS="-DFAST_FUNC= -flto" and compile with LTO without a source code hack. Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* include/platform.h: Remove extra #endif introduced in 6df9612.Ari Sundholm2015-12-171-1/+0
| | | | | | | It causes the compilation to fail. Signed-off-by: Ari Sundholm <ari@tuxera.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Resolve linker issues with Android API 21 (dprintf, tcdrain)Chris Renshaw2015-12-171-1/+6
| | | | | Signed-off-by: Chris Renshaw <osm0sis@outlook.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Conditionalize Bionic workarounds on __ANDROID_API__Matt Whitlock2015-05-031-4/+10
| | | | | Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Bionic lacks mempcpy; enable existing workaroundMatt Whitlock2015-05-031-0/+1
| | | | | Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Bionic lacks ttyname_r; provide a workaroundMatt Whitlock2015-04-251-0/+7
| | | | | Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* gzip: speed up and shrink put_16bit()Denys Vlasenko2015-02-021-0/+2
| | | | | | | function old new delta put_16bit 104 98 -6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* platform.h: enable mempcpy for FreeBSDDenys Vlasenko2015-02-021-1/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* platform.h: mempcpy needs <string.h>Denys Vlasenko2015-01-291-0/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* platform.h: add compat mempcpyDenys Vlasenko2015-01-251-0/+9
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Rename INIT_LAST to INIT_FUNC to avoid confusionBartosz Golaszewski2014-06-301-2/+2
| | | | | | | | | | | We don't have an INIT_FIRST, so let's rename INIT_LAST to INIT_FUNC to imply that the function is called at program start-up. Also: the priority argument for __attribute__((constructor)) isn't used, so let's remove it. Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* unit-tests: implement the unit-testing frameworkBartosz Golaszewski2014-06-221-0/+3
| | | | | | | | | | | | | | This set of patches adds a simple unit-testing framework to Busybox unit-tests: add some helper macros for unit-test framework implementation unit-tests: implement the unit-testing framework unit-tests: add basic documentation on writing the unit test cases unit-tests: modify the Makefile 'test' target to run unit-tests too unit-tests: add two example test cases unit-tests: modify the existing strrstr test code to use the unit-test framework Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: provide usleep() fallback implementationBernhard Reutner-Fischer2014-04-131-2/+14
| | | | | | | | POSIX.1-2008 removed the usleep function, provide a fallback implementaion using the recommended nanosleep(). Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Another FreeBSD fix from Matthias AndreeDenys Vlasenko2014-01-081-3/+12
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* platform.h: undef HAVE_STRCHRNUL only on correct versions of FreeBSDDenys Vlasenko2014-01-071-5/+12
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* platform: strchrnul is missing if __APPLE__Daniel Borca2013-11-271-1/+1
| | | | | Signed-off-by: Daniel Borca <dborca@yahoo.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* md5/sha512: a better fix for strict aliasing warningsDenys Vlasenko2013-06-271-0/+1
| | | | | | | The locations *are* well-aligned for direct stores on any architecture. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* platform: use KERNEL_VERSION to simplify uClibc version checkingMike Frysinger2013-03-121-9/+11
| | | | | | | | This makes reading the logic (as well as adding new code) a lot simpler, and fixes one or two cases that were broken due to incorrect sub-version tests. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Fix move_to_unaligned16Denys Vlasenko2013-02-271-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sha3sum: new appletLauri Kasanen2013-01-141-1/+4
| | | | | | | | | | | | | | | | | | | | | | function old new delta KeccakF - 496 +496 KeccakF_RoundConstants - 192 +192 sha3_hash - 171 +171 sha3_end - 40 +40 hash_file 274 299 +25 KeccakF_RotationConstants - 25 +25 KeccakF_PiLane - 25 +25 packed_usage 29213 29232 +19 sha3_begin - 18 +18 KeccakF_Mod5 - 10 +10 applet_names 2445 2453 +8 applet_main 1420 1424 +4 applet_nameofs 710 712 +2 ------------------------------------------------------------------------------ (add/remove: 8/0 grow/shrink: 9/7 up/down: 1049/-54) Total: ~995 bytes Signed-off-by: Lauri Kasanen <curaga@operamail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* platform.h: disable ALIGNn macros for s390[x]Denys Vlasenko2012-08-061-1/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* platform.h: Android tweaks: ioprio defines, BB_ADDITIONAL_PATHTias Guns2012-06-101-0/+6
| | | | | Signed-off-by: Tias Guns <tias@ulyssis.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Move Adroid endgrent() and endpwent() NOPS to libbb.hDenys Vlasenko2012-01-081-5/+0
| | | | | | They should be after includes of pwd.h and grp.h Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* platform.h: define endgrent() and endpwent() as no-ops on AndroidDenys Vlasenko2012-01-061-0/+5
| | | | | | Surprisingly, bionic libc seems to lack these functions. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* disable strverscmp usage if we build against uClibc-0.9.31Oliver Metz2011-10-091-1/+1
| | | | | Signed-off-by: Oliver Metz <oliver.metz@googlemail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Android build fixes and alternate (hopefully simpler) defconfig for itDenys Vlasenko2011-09-091-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Fixes for FreeBSD buildMatthias Andree2011-08-281-0/+2
| | | | | Signed-off-by: Matthias Andree <mandree@freebsd.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* more tweak for bionicDenys Vlasenko2011-07-081-1/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* platform.h: tweaks for cygwinDenys Vlasenko2011-07-081-1/+14
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Use the _unlocked stdio macros only when they're all availableDan Fandrich2011-06-301-5/+5
| | | | | Signed-off-by: Dan Fandrich <dan@coneharvesters.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Use the built-in getline on more systems that don't have itDan Fandrich2011-06-301-5/+13
| | | | | Signed-off-by: Dan Fandrich <dan@coneharvesters.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* platform.c: provide getline implementationTimo Teras2011-06-291-0/+5
| | | | | Signed-off-by: Timo Teras <timo.teras@iki.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: fix HAVE_STRVERSCMP check; add check for older uclibc versionsDenys Vlasenko2011-06-211-0/+10
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Add HAVE_STRVERSCMP, guard the only usage of strverscmp with #ifdefDenys Vlasenko2011-06-211-0/+5
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: simplify Ethernet header includesDan Fandrich2011-06-101-3/+10
| | | | | Signed-off-by: Dan Fandrich <dan@coneharvesters.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* platform.h: support for build under AndroidDan Fandrich2011-06-031-0/+6
| | | | | Signed-off-by: Dan Fandrich <dan@coneharvesters.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>