Commit Graph

137 Commits

Author SHA1 Message Date
Dan Fandrich
fe4e23f9de Add more compat code for non GNU environments
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-01 04:01:30 +01:00
Dan Fandrich
21a542d7d7 platform compatibility work (by Dan Fandrich)
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-27 11:05:00 +01:00
Denys Vlasenko
da49f58524 move libc related stuff out of platform.h
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-08 02:58:38 +02:00
Denys Vlasenko
9b1b62adc4 Patches to enable FreeBSD build
platform.h: fix wrong check for endianness, fix lchown
aliasing to chown on uclibc.

Code seems to not be affected in my testing.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-05 03:34:12 +02:00
Denys Vlasenko
5a49d284a6 add platform tweaks
login: consider platforms having no domainname field in the utsname struct
include/platform.h: define IUCLC to 0 on platforms where it is not defined

Signed-off-by: Luca Favatella <slackydeb@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-19 13:18:45 +02:00
Denis Vlasenko
3be2308676 fix move_to_unaligned32 2009-04-17 22:20:44 +00:00
Denis Vlasenko
f81e8dbc74 *: make "pragma GCC visibility push(hidden)" less ugly 2009-04-09 12:35:13 +00:00
Denis Vlasenko
551ffdccea more of pointless whitespace fixes 2009-04-01 19:48:05 +00:00
Denis Vlasenko
efb545b9bd optimize 16- and 32-bit moves
function                                             old     new   delta
udhcpd_main                                         1239    1257     +18
udhcp_add_simple_option                               93      92      -1
buffer_read_le_u32                                    19      18      -1
unpack_gz_stream_with_info                           526     520      -6
dnsd_main                                           1470    1463      -7
udhcp_run_script                                    1208    1186     -22
send_ACK                                             255     229     -26
arping_main                                         1661    1623     -38
send_offer                                           470     428     -42
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/8 up/down: 18/-143)          Total: -125 bytes
2008-12-08 22:56:18 +00:00
Denis Vlasenko
6ebb2f56d5 crond: use bb_setpgrp, not setpgrp
platform.h: make a bit more readable
2008-12-03 10:46:12 +00:00
Denis Vlasenko
9b0f6e1142 add comment, no code changes 2008-11-01 13:40:32 +00:00
Bernhard Reutner-Fischer
6c4dadefb6 - update my name. No obj-code changes ;) 2008-09-25 12:13:34 +00:00
Bernhard Reutner-Fischer
fb5902ca5c - support relatime / norelatime 2008-08-06 18:14:38 +00:00
Denis Vlasenko
a60f84ebf0 *: rename ATTRIBUTE_XXX to just XXX. 2008-07-05 09:18:54 +00:00
Denis Vlasenko
ac2b50ebea add stdcall to FAST_FUNC
text    data     bss     dec     hex filename
 804476     611    6868  811955   c63b3 busybox_old
 804373     611    6868  811852   c634c busybox_unstripped
2008-06-27 04:30:48 +00:00
Denis Vlasenko
42b8daf88a expand comment about FAST_FUNC 2008-06-27 03:55:18 +00:00
Denis Vlasenko
defc1ea340 *: introduce and use FAST_FUNC: regparm on i386, otherwise no-on
text    data     bss     dec     hex filename
 808035     611    6868  815514   c719a busybox_old
 804472     611    6868  811951   c63af busybox_unstripped
2008-06-27 02:52:20 +00:00
Denis Vlasenko
21765fa063 udhcpc: kill undocumented -W, it was a no-op.
fix option parsing in the case some CONFIG_x are off.
 disable -b on NOMMU, make backgrounding work correctly
 (if a bit differently from MMU case). Previously,
 it wasn't working at all.
 stop using global data for flags in main(), opt
 bitfield works as well.

function                                             old     new   delta
cryptpw_main                                         177     153     -24
packed_usage                                       24478   24452     -26
client_background                                     26       -     -26
udhcpc_main                                         2462    2372     -90
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/3 up/down: 0/-166)           Total: -166 bytes
2008-06-13 20:44:05 +00:00
Denis Vlasenko
fc9e108032 udhcpc: shrink
udhcpc: guard against zero lease time

function                                             old     new   delta
timeout                                                4       -      -4
server_addr                                            4       -      -4
requested_ip                                           4       -      -4
perform_release                                      134     112     -22
udhcpc_main                                         2511    2485     -26
------------------------------------------------------------------------------
(add/remove: 0/3 grow/shrink: 0/2 up/down: 0/-60)             Total: -60 bytes
2008-05-26 17:32:35 +00:00
Denis Vlasenko
98636eb08c Use intra-DSO calls when we build libbusybox. No-op for normal build.
This was Bernhard Fischer' idea.

   text    data     bss     dec     hex filename
 773549    7781    9740  791070   c121e busybox.t7/0_lib/libbusybox.so.1.11.0.svn_unstripped
 769683    7397    9740  786820   c0184 busybox.t9t/0_lib/libbusybox.so.1.11.0.svn_unstripped
2008-05-09 17:59:34 +00:00
Denis Vlasenko
812870a2e7 remove stray semicolon 2008-04-30 13:56:32 +00:00
Denis Vlasenko
0f3a580c4f gcc compat fix and warning suppression
by Joe Krahn <krahn AT niehs.nih.gov>
2008-03-20 13:13:09 +00:00
Denis Vlasenko
87cf2ee8ab tar: move FNM_LEADING_DIR #define to tar.c - no other users.
Closes bug 1332.
2008-02-13 17:06:53 +00:00
Mike Frysinger
9412ec7555 some more fixes for cross-compiling on an OS X host: apple provides core types so dont redefine them, sys/statfs.h is not available, and only use some newer AF_* defines if they are actually available 2008-02-07 22:41:33 +00:00
Mike Frysinger
22876c797c only include mntent.h according to HAVE_MNTENT_H and dont define this on OS X 2008-02-07 22:10:07 +00:00
Bernhard Reutner-Fischer
8c69afd992 - be C99 friendly. Anonymous unions are a GNU extension. This change is
size-neutral WRT -std=gnu99 and fixes several compilation errors for strict
  C99 mode.
2008-01-29 10:33:34 +00:00
Denis Vlasenko
9e58921e7e comment fix 2008-01-24 01:33:42 +00:00
Denis Vlasenko
d2c450ce81 hush: report [v]fork failures
hush: more correct handling of piping
config: add CONFIG_NOMMU
2008-01-08 20:32:12 +00:00
Denis Vlasenko
77f1ec1b9b bzip2: port bzip2 1.0.4 to busybox. note: bzip2 code resides
in separate directory (archival/bz/*)
and is covered by BSD-style license.
code size: 13k
2007-10-13 03:36:03 +00:00
Denis Vlasenko
9b49a5ed85 add -fvisibility=hidden to CC flags, mark XXX_main functions
EXTERNALLY_VISIBLE. 5% size reduction of libbusybox.so
2007-10-11 10:05:36 +00:00
Denis Vlasenko
4c1d88daff top: get rid of on-stack variable buffers, use permanent one.
code shrank with and without TOPMEM:

top_main                                             828     844     +16
display_process_list                                1525    1473     -52
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 16/-52)            Total: -36 bytes

top_main                                            1150    1171     +21
display_topmem_process_list                         1150    1167     +17
display_process_list                                1525    1473     -52
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 38/-52)            Total: -14 bytes
2007-09-08 17:34:05 +00:00
Denis Vlasenko
6ca409e0e4 trylink: produce even more info about final link stage
trylink: explain how to modify link and drastically decrease amount
  of padding (unfortunately, needs hand editing ATM).
*: add ALIGN1 / ALIGN2 to global strings and arrays of bytes and shorts

size saving: 0.5k
2007-08-12 20:58:27 +00:00
Bernhard Reutner-Fischer
9a33780152 - add ATTRIBUTE_UNUSED_RESULT for internal use 2007-06-21 10:39:20 +00:00
Denis Vlasenko
3ad5d0cbbe diff: shrink code (-85 bytes):
function                                             old     new   delta
fiddle_sum                                             8       -      -8
diffreg                                             2717    2690     -27
prepare                                              334     284     -50
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/2 up/down: 0/-85)             Total: -85 bytes

s/ATTRIBUTE_ALWAYS_INLINE/ALWAYS_INLINE/g
2007-06-12 20:54:54 +00:00
Denis Vlasenko
734e5ebc93 fix -Werror compile 2007-05-04 21:38:14 +00:00
Denis Vlasenko
ac678ec2f1 style fixes, no code changes 2007-04-16 22:32:04 +00:00
Denis Vlasenko
87468857f6 style fixes 2007-04-13 23:22:00 +00:00
Denis Vlasenko
0de3c55b42 login: remove setpgrp call (makes it work from shell prompt again).
login: sanitize stdio descriptors (we are suid, need to be careful!)
shrink login and set_environment by ~100 bytes.
2007-04-12 12:31:02 +00:00
Denis Vlasenko
473dae080a add more convenient defines for [NO]MMU:
"#ifndef BB_NOMMU" is a double negative
2007-04-11 07:04:23 +00:00
Bernhard Reutner-Fischer
51f7ab6162 - add ATTRIBUTE_DEPRECATED for functions that should be removed in the future.
This is ment to provide means to point at cruft marked for cleanup.
2007-04-10 18:40:05 +00:00
Bernhard Reutner-Fischer
be862096c0 - be gentle to the intel compiler and make sure we have __u64 which is needed for linux/loop.h 2007-03-19 15:15:06 +00:00
Bernhard Reutner-Fischer
a8e2e1872a - add C99 bool type for setups that support it. 2007-01-20 21:27:18 +00:00
Bernhard Reutner-Fischer
c966ba46a9 - move the smallint that is platform dependant to it's proper place 2007-01-18 10:32:09 +00:00
Denis Vlasenko
13463af29f remove commented out #includes etc
move get_hz to the only caller
2006-12-31 18:58:32 +00:00
Denis Vlasenko
98ee06d3d4 stop using __u32 etc. uint32_t is there for a reason 2006-12-31 18:57:37 +00:00
Denis Vlasenko
bf0a201008 style fixes
last xcalloc replaced by xzalloc
2006-12-26 10:42:51 +00:00
Denis Vlasenko
7cfecc4b36 xfuncs.c: dietlibc actually HAS fdprintf!
platform.h: define strchrnul for dietlibc
ash: stop using few non-standard functions
2006-12-18 22:32:45 +00:00
Denis Vlasenko
c8e6e35ba4 nc: add missing cast
xfuncs: add dprintf for dietlibc
2006-12-18 22:10:24 +00:00
Denis Vlasenko
a597aaddfa s/extern inline/static ATTRIBUTE_ALWAYS_INLINE/g
xstrtou: disallow leading '+'
2006-12-16 23:48:13 +00:00
Denis Vlasenko
a7189f01a4 add -Wundef, fix uncovered bugs 2006-11-17 20:29:00 +00:00
Denis Vlasenko
9213a9e0f2 whitespace cleanup 2006-09-17 16:28:10 +00:00
Rob Landley
577905f1e4 Revert duplicate patch.
I don't know why patch decided to apply this even though it was already in
the tree.  I thought the other hunks failed because they were totally
unrelated leakage from Bernhard's tree (which they are; was the a reason
for bundling them in with this fix?  Do they have something to do with
the GCC 2.95 fix?  I suspect they prevent me from backporting this
patch to 1.2.2 because the header consolidation into libbb.h hadn't
been done yet, and no I'm not fixing it up: if that's the case then
this patch won't be in 1.2.2 due to extraneous changes bundled with it that
prevent a clean backport without rolling a new patch).
2006-09-12 22:42:03 +00:00
Rob Landley
1b2b5cfba8 Fix from Bernhard for somebody trying to limp along with gcc 2.95.4. 2006-09-12 20:29:22 +00:00
Bernhard Reutner-Fischer
b5f50ea344 - small trivia to be gentle to gcc-2.95.x which had no va_copy but only __va_copy. 2006-09-12 13:27:55 +00:00
Rob Landley
b988462d3e Ok, features.h already defines _OPEN_SOURCE (and complains if it's already
defined), yet it's not doing it for scripts/individual for some reason.
(I hate fighting with header files.)
2006-08-10 01:08:41 +00:00
Rob Landley
519d7df930 Another whack at scripts/individual. Now builds 212 applets. 2006-08-09 20:56:23 +00:00
Rob Landley
e3781b7312 Add shared subtree support, suggested by Vladimir Dronnikov. Also break out a
few new (unfinished) config options, which I intend to make hidden (but
enabled) when CONFIG_NITPICK is disabled.  Getting the .config infrastructure
to do that is non-obvious, it seems...
2006-08-08 01:39:49 +00:00
Mike Frysinger
8840759c61 move lchown/chown define out of specific files and into platform.h where it belongs 2006-07-20 19:31:07 +00:00
Rob Landley
7077ea30f5 Some old kernel headers don't #include BLKSSZGET in sys/mount.h. 2006-06-29 19:00:12 +00:00
Rob Landley
1fa4a9448b Patch from Shaun Jackman to replace CFLAGS_EXTRA with .config.mak 2006-06-22 22:05:00 +00:00
Rob Landley
148734df99 We came up with our own names for ATTRIBUTE_*, so why check if they're already
#defined?  Also remove a check for a gcc version older than RH9 (if non-linux
needs that #define they can put it in their section.)
2006-06-15 16:00:42 +00:00
Rob Landley
22d26fc6ae Patch from Yann Morin to put BLKGETSIZE64 in platform.h had rather a lot of
fallout due to the #include <sys/mount.h>.  Removed that #include from various
applets and fixed up those that were unhappy when that #include was made
because they'd block copied stuff out of it.  (Sigh.)
2006-06-15 15:49:36 +00:00
Rob Landley
18958e9309 Random cleanup of platform.h. 2006-06-13 18:28:33 +00:00
Mike Frysinger
b16b5bb08f only check __GNU_LIBRARY__ if it is actually defined 2006-06-06 06:00:20 +00:00
Rob Landley
8fc32d9326 Shaun Jackman pointed out that KERNEL_VERSION() is used without guards, so
defining it in a guard is silly.
2006-06-01 00:52:30 +00:00
Bernhard Reutner-Fischer
507cd755a4 - conditionally define BB_NOMMU 2006-05-31 10:04:03 +00:00
Rob Landley
752f0a6001 Put parentheses around some of the SWAP() macros, as pointed out by Peter
Kjellerstedt.
2006-05-30 06:28:03 +00:00
Rob Landley
bba7f08d27 Add SWAP_LE?? and SWAP_BE?? macros, and make things use them. Converts values
to/from little endian or big endian, which is a NOP if that's what the current
platform already is.
2006-05-29 05:51:12 +00:00
Rob Landley
15d20a03d6 Remove _() and N_() from platform.h. #define them as NOP macros in the two
files still using them.  I didn't remove them from e2fsck.c to avoid stomping
pending cleanup patches from Garrett, and I didn't bother to remove them from
fdisk.c because that entire file needs to be rewritten from scratch.
2006-05-29 05:00:44 +00:00
Rob Landley
8fba99f35e Move portability stuff to platform.h, and clean up adjtimex.c a bit while
I'm in the area.
2006-05-27 22:08:01 +00:00
Bernhard Reutner-Fischer
4ed1f1d99d - add workaround for tar being broken since it uses a non-portable constant. 2006-05-26 13:34:25 +00:00
Bernhard Reutner-Fischer
e00fc16aaa - move libc checks from busybox.h to platform.h
- add ATTRIBUTE_ALWAYS_INLINE, endian handling for DEC UNIX, some more
  compiler dependent defines to platform.h
- add conditional bb_setpgrp define to platform.h
- remove superfluous specifying args from "#define fdprintf dprintf"
2006-05-26 13:10:10 +00:00
Rob Landley
c020f5f518 New version of nohup that's much smaller, less paranoid, consistent,
vaguely portable, and licensed GPLv2 "or later".
2006-05-21 18:28:13 +00:00
Bernhard Reutner-Fischer
35017fb4fc - backout erroneously checked in snippet.. 2006-05-19 20:48:22 +00:00
Bernhard Reutner-Fischer
b1629b1b2a - remove emacs layout block as suggested by Robert P.J. Day
- use shorter boilerplate while at it
2006-05-19 19:29:19 +00:00
Bernhard Reutner-Fischer
e2e56c7c41 - single KERNEL_VERSION(a,b,c) macro in platform.h
- rename get_kernel_revision() to get_linux_version_code
from Robert P. J. Day
2006-05-19 11:54:02 +00:00
Rob Landley
a389651115 Remove bb_strlen() in favor of -fno-builtin-strlen. Saves as many bytes
as the old optimization did (actually does slightly better under gcc 4.0), and
simplifies the code.
2006-05-07 20:20:34 +00:00
Rob Landley
552b56dfd1 Not quite compiler independent, but we've never tried to be gcc independent
anyway.  This is at least less ugly than what was there before, and fixes
building all sources at once.
2006-05-04 21:22:27 +00:00
Mike Frysinger
f885513940 just whitespace fixes 2006-03-28 02:35:56 +00:00
Rob Landley
90ece609e6 Define both big endian and little endian macros. 2006-03-25 03:01:59 +00:00
Mike Frysinger
64bef2ab9c fix typo 2006-03-23 02:06:29 +00:00
Rob Landley
dae6aa2859 Fixup to the previous (portability) patch. Linux actually does need
arpa/inet.h rather than netinet/in.h, otherwise we get warnings.
2006-03-09 22:39:08 +00:00
Bernhard Reutner-Fischer
ed7bb6278d - put NLS stuff in one central place to avoid redefines.
Fixes warnings about:
fdisk.c:45:1: warning: "_" redefined
nfsmount.c:121:1: warning: "_" redefined
nfsmount.c:122:1: warning: "N_" redefined
interface.c:84:1: warning: "_" redefined
2006-02-23 14:25:15 +00:00
Rob Landley
5cf7c2df66 Patch from Devin Bayer to split up hash_fd.c into md5.c and sha1.c. (I tweaked
md5_sha1_sum.c to convert some #ifdef CONFIG to if(ENABLE).)
2006-02-21 06:44:43 +00:00
Rob Landley
7bfa88f315 New USE() macros
For each CONFIG_SYMBOL, include/bb_config.h now has both ENABLE_SYMBOL
and USE_SYMBOL(x).  ENABLE_SYMBOL is still always defined (1 or 0) so that
if(ENABLE) should optimize out when it's zero.  The USE_SYMBOL(X) will only
splice in X if the symbol is defined, otherwise it'll be empty.

Thus we can convert this:

#ifdef CONFIG_ARGS
    opt = bb_getopt_ulflags(argc, argv, "ab:c"
#ifdef CONFIG_THINGY
        "d:"
#endif
        , &bvalue
#ifdef CONFIG_THINGY
        , &thingy
#endif
    );
#endif

into this:
    if (ENABLE_ARGS) {
        opt = bb_getopt_ulflags(argc, argv, "ab:c" USE_THINGY("d:"), &bvalue
                USE_THINGY(, &thingy));
    }

And it should produce the same code.

Unlike the old versions in include/_usage.h, the new USE_SYMBOL(x) can handle
commas in its arguments (as shown above).  (The _usage.h file is obsolete and
no longer generated.)

Nobody should need to include config.h directly anymore, bb_config.h should
define all the configuration stuff we need.  Someday, the CONFIG_SYMBOL
versions should go away in favor of ENABLE_SYMBOL and USE_SYMBOL().

Thanks to vodz for the new version of bb_mkdep.c that works with function
macros.
2006-02-13 19:16:41 +00:00
Bernhard Reutner-Fischer
9f4a1e1c75 - add and use ATTRIBUTE_ALIGNED(num_bytes)
- remove unused parameter pindex from fdisk.c, xbsd_initlabel()
2006-01-31 09:53:53 +00:00
Bernhard Reutner-Fischer
86f5c9906b - add platform.h.
- use shorter boilerplate while at it.
2006-01-22 22:55:11 +00:00