aboutsummaryrefslogtreecommitdiff
path: root/include/platform.h
AgeCommit message (Collapse)Author
2021-02-18ash: placate -Werror=format-securityDenys Vlasenko
"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>
2021-01-04Fix bb_setpgrp weapper on the FreeBSDAlex Samorukov
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>
2020-11-30decrease paddign: gcc-9.3.1 slaps 32-byte alignment on arrays willy-nillyDenys Vlasenko
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>
2020-06-23randomconfig fixDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-23tls: code shrinkDenys Vlasenko
function old new delta xwrite_encrypted 599 585 -14 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-10Hopefully fix "will break strict-aliasing rules" warning for get_le32Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-28ash: support platforms that don't have '%m' printf specifierRon Yorston
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>
2017-07-28ash: less hackish implementation of evaltreenr()Denys Vlasenko
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>
2017-07-15Move get_unaligned_le32() macros to platform.hDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09Allow FAST_FUNC to be overridden at build timeKang-Che Sung
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>
2015-12-17include/platform.h: Remove extra #endif introduced in 6df9612.Ari Sundholm
It causes the compilation to fail. Signed-off-by: Ari Sundholm <ari@tuxera.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2015-12-17Resolve linker issues with Android API 21 (dprintf, tcdrain)Chris Renshaw
Signed-off-by: Chris Renshaw <osm0sis@outlook.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-05-03Conditionalize Bionic workarounds on __ANDROID_API__Matt Whitlock
Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-05-03Bionic lacks mempcpy; enable existing workaroundMatt Whitlock
Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-04-25Bionic lacks ttyname_r; provide a workaroundMatt Whitlock
Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-02gzip: speed up and shrink put_16bit()Denys Vlasenko
function old new delta put_16bit 104 98 -6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-02platform.h: enable mempcpy for FreeBSDDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-29platform.h: mempcpy needs <string.h>Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-25platform.h: add compat mempcpyDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-30Rename INIT_LAST to INIT_FUNC to avoid confusionBartosz Golaszewski
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>
2014-06-22unit-tests: implement the unit-testing frameworkBartosz Golaszewski
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>
2014-04-13libbb: provide usleep() fallback implementationBernhard Reutner-Fischer
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>
2014-01-08Another FreeBSD fix from Matthias AndreeDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-07platform.h: undef HAVE_STRCHRNUL only on correct versions of FreeBSDDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-27platform: strchrnul is missing if __APPLE__Daniel Borca
Signed-off-by: Daniel Borca <dborca@yahoo.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-06-27md5/sha512: a better fix for strict aliasing warningsDenys Vlasenko
The locations *are* well-aligned for direct stores on any architecture. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-12platform: use KERNEL_VERSION to simplify uClibc version checkingMike Frysinger
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>
2013-02-27Fix move_to_unaligned16Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14sha3sum: new appletLauri Kasanen
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>
2012-08-06platform.h: disable ALIGNn macros for s390[x]Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-10platform.h: Android tweaks: ioprio defines, BB_ADDITIONAL_PATHTias Guns
Signed-off-by: Tias Guns <tias@ulyssis.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-08Move Adroid endgrent() and endpwent() NOPS to libbb.hDenys Vlasenko
They should be after includes of pwd.h and grp.h Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-06platform.h: define endgrent() and endpwent() as no-ops on AndroidDenys Vlasenko
Surprisingly, bionic libc seems to lack these functions. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-09disable strverscmp usage if we build against uClibc-0.9.31Oliver Metz
Signed-off-by: Oliver Metz <oliver.metz@googlemail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-09Android build fixes and alternate (hopefully simpler) defconfig for itDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-28Fixes for FreeBSD buildMatthias Andree
Signed-off-by: Matthias Andree <mandree@freebsd.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-08more tweak for bionicDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-08platform.h: tweaks for cygwinDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-30Use the _unlocked stdio macros only when they're all availableDan Fandrich
Signed-off-by: Dan Fandrich <dan@coneharvesters.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-30Use the built-in getline on more systems that don't have itDan Fandrich
Signed-off-by: Dan Fandrich <dan@coneharvesters.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-29platform.c: provide getline implementationTimo Teras
Signed-off-by: Timo Teras <timo.teras@iki.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-21ls: fix HAVE_STRVERSCMP check; add check for older uclibc versionsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-21Add HAVE_STRVERSCMP, guard the only usage of strverscmp with #ifdefDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-10*: simplify Ethernet header includesDan Fandrich
Signed-off-by: Dan Fandrich <dan@coneharvesters.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-03platform.h: support for build under AndroidDan Fandrich
Signed-off-by: Dan Fandrich <dan@coneharvesters.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-12libbb.h: use inlined sigfillset, sigemptyset, sigisemptyset on uclibcDenys Vlasenko
text data bss dec hex filename 875879 493 7584 883956 d7cf4 busybox_old 875879 493 7584 883956 d7cf4 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-17straighten out dprintf/fdprintf mess; remove old "define lchown chown"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-13Move stpcpy replacement function into libbbDan Fandrich
Signed-off-by: Dan Fandrich <dan@coneharvesters.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-08use unistd.h before _POSIX_VERSIONDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-07incorporate header fixes proposed in bug 3097Denys Vlasenko
Not sure these are *really* needed, but I suppose they don't hurt Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>