Commit Graph

2081 Commits

Author SHA1 Message Date
Stephen Heumann 99224d3946 Address a couple errors identified by ORCA/C 2.2.0 B2.
One of these concerned socket-related structures that aren't really used in hush. The other was a reliance on a GCC-specific feature (arithmetic on void pointers); this code is actually used in hush, although I'm not sure if the error was causing any real problems.
2017-12-31 16:07:51 -06:00
Stephen Heumann 16cd3c0619 Merge with BusyBox 1.24.0.
There's really only one bug fix in here that should be significant for GNO hush. The other changes should be inconsequential, AFAIK.
2015-10-17 01:10:35 -05:00
Denys Vlasenko e52da5570e libbb: auto_string() for efficient handling of temporary malloced stirngs
Use it in libiproute: get rid of one static string buffer.

function                                             old     new   delta
auto_string                                            -      51     +51
ll_index_to_name                                      10      49     +39
buffer_fill_and_print                                169     178      +9
scan_recursive                                       378     380      +2
decode_one_format                                    732     734      +2
cmdputs                                              334     332      -2
static.cur_saved                                       4       1      -3
static.nbuf                                           16       -     -16
printable_string                                      94      57     -37
ll_idx_n2a                                            53       -     -53
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 4/3 up/down: 103/-111)           Total: -8 bytes
   text	   data	    bss	    dec	    hex	filename
 939880	    992	  17496	 958368	  e9fa0	busybox_old
 939880	    992	  17480	 958352	  e9f90	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-09 17:59:56 +02:00
Denys Vlasenko 550bf5b4a4 remove global "jmp_buf die_jmp" from !FEATURE_PREFER_APPLETS builds
function                                             old     new   delta
xfunc_has_died                                         -      21     +21
sleep_much                                             -      12     +12
sleep10                                                -       9      +9
die_func                                               -       4      +4
fflush_stdout_and_exit                                35      36      +1
builtin_type                                         121     119      -2
die_sleep                                              4       -      -4
xfunc_die                                             60      24     -36
hush_main                                           1128    1011    -117
die_jmp                                              156       -    -156
------------------------------------------------------------------------------
(add/remove: 4/2 grow/shrink: 1/3 up/down: 47/-315)          Total: -268 bytes
   text	   data	    bss	    dec	    hex	filename
 939992	    992	  17652	 958636	  ea0ac	busybox_old
 939880	    992	  17496	 958368	  e9fa0	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-09 16:42:57 +02:00
Denys Vlasenko 5711a2a4ad libbb: more compact API for bb_parse_mode()
function                                             old     new   delta
make_device                                         2182    2188      +6
parse_command                                       1440    1443      +3
parse_params                                        1497    1499      +2
install_main                                         773     769      -4
mkdir_main                                           168     160      -8
getoptscmd                                           641     632      -9
builtin_umask                                        158     147     -11
bb_parse_mode                                        431     410     -21
umaskcmd                                             286     258     -28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/6 up/down: 11/-81)            Total: -70 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-07 17:55:33 +02:00
Denys Vlasenko 1c6c670ed4 wget: make openssl/ssl_helper choice configurable
I got sick of not being able to wget a https file...

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-07 01:39:40 +02:00
Bartosz Golaszewski 7448b513c8 libbb: add is_suffixed_with() function
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-25 16:36:43 +02:00
Denys Vlasenko c52cbea2bb libbb: add setsockopt_foo helpers
function                                             old     new   delta
setsockopt_int                                         -      23     +23
do_load                                              918     934     +16
setsockopt_SOL_SOCKET_int                              -      14     +14
setsockopt_keepalive                                   -      10     +10
setsockopt_SOL_SOCKET_1                                -      10     +10
buffer_fill_and_print                                169     178      +9
setsockopt_1                                           -       8      +8
nfsmount                                            3560    3566      +6
redirect                                            1277    1282      +5
tcpudpsvd_main                                      1782    1786      +4
d6_send_kernel_packet                                272     275      +3
i2cget_main                                          380     382      +2
ed_main                                             2544    2545      +1
scan_recursive                                       380     378      -2
nbdclient_main                                       492     490      -2
hash_find                                            235     233      -2
cmdputs                                              334     332      -2
parse_command                                       1443    1440      -3
static.two                                             4       -      -4
ntpd_main                                           1039    1035      -4
const_int_1                                            4       -      -4
const_IPTOS_LOWDELAY                                   4       -      -4
RCVBUF                                                 4       -      -4
ntp_init                                             474     469      -5
change_listen_mode                                   316     310      -6
uevent_main                                          416     409      -7
arping_main                                         1697    1690      -7
telnet_main                                         1612    1603      -9
socket_want_pktinfo                                   42      33      -9
setsockopt_reuseaddr                                  21      10     -11
setsockopt_broadcast                                  21      10     -11
httpd_main                                           772     757     -15
get_remote_transfer_fd                               109      94     -15
make_new_session                                     503     487     -16
ftpd_main                                           2177    2160     -17
read_bunzip                                         1896    1866     -30
common_traceroute_main                              4099    4058     -41
common_ping_main                                    1836    1783     -53
------------------------------------------------------------------------------
(add/remove: 5/4 grow/shrink: 8/21 up/down: 111/-283)        Total: -172 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-24 20:00:17 +02:00
Bartosz Golaszewski d077565bb2 unit-tests: remove unnecesary field from struct bbunit_listelem
In the initial submission struct bbunit_listelem was manipulated by
custom list functions implemented in bbunit.c. Since the tests are now
added to the list by llist_add_to_end(), which allocates the llist_t
objects behind the scenes, there's no need for the *next field.

function                                             old     new   delta
unit_main                                            142     141      -1
bbunit_strrstr_elem                                   24      16      -8
bbunit_obscure_weak_pass_elem                         24      16      -8
bbunit_obscure_strong_pass_elem                       24      16      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-25)             Total: -25 bytes

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-17 17:00:10 +02:00
Denys Vlasenko 35ae2ccb40 sync: add support for -d -f FILE
Based on the patch by Ari Sundholm <ari@tuxera.com>

function                                             old     new   delta
sync_main                                             20     163    +143
packed_usage                                       30653   30673     +20
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 163/0)             Total: 163 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-21 19:50:48 +02:00
Ron Yorston d840c5d139 libbb: add a function to make a copy of a region of memory
Introduce a library routine to package the idiom:

    p = xmalloc(b, n);
    memcpy(p, b, n);

and use it where possible.  The example in traceroute used xzalloc
but it didn't need to.

function                                             old     new   delta
xmemdup                                                -      32     +32
last_main                                            834     826      -8
make_device                                         2321    2311     -10
common_traceroute_main                              3698    3685     -13
readtoken1                                          3182    3168     -14
procps_scan                                         1222    1206     -16
forkchild                                            655     638     -17
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/6 up/down: 32/-78)            Total: -46 bytes

Signed-off-by: Ron Yorston <rmy@frippery.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-19 23:05:20 +02:00
Matt Whitlock 778efe37ee Conditionalize Bionic workarounds on __ANDROID_API__
Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-05-03 19:33:32 +02:00
Matt Whitlock f23e3ec529 Bionic lacks mempcpy; enable existing workaround
Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-05-03 18:57:44 +02:00
Matt Whitlock cee59053dc Bionic lacks ttyname_r; provide a workaround
Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-04-25 21:32:48 +02:00
Bernhard Reutner-Fischer 7d86384b24 include: Fallback to UTMP unless there is UTMPX support
Fixes compilation against uClibc-0.9.30 for instance

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-20 15:24:30 +02:00
Ron Yorston 61d6ae244a libbb: remove unnecessary argument to nonblock_immune_read
The loop_on_EINTR argument to nonblock_immune_read is always set to 1.

function                                             old     new   delta
xmalloc_reads                                        200     195      -5
pgetc                                                488     483      -5
argstr                                              1313    1308      -5
nonblock_immune_read                                 123      86     -37
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-52)             Total: -52 bytes

Signed-off-by: Ron Yorston <rmy@tigress.co.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-04-20 13:41:32 +02:00
Bernhard Reutner-Fischer 86a7f18f21 *: Switch to POSIX utmpx API
UTMP is SVID legacy, UTMPX is mandated by POSIX.

Glibc and uClibc have identical layout of UTMP and UTMPX, both of these
libc treat _PATH_UTMPX as _PATH_UTMP so from a user-perspective nothing
changes except the names of the API entrypoints.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-02 23:03:46 +02:00
Ari Sundholm 911db16229 truncate: new applet
function                                             old     new   delta
truncate_main                                          -     161    +161
cwbkMG_suffixes                                        -     128    +128
packed_usage                                       30443   30459     +16
applet_names                                        2512    2521      +9
applet_main                                         1456    1460      +4
parse_command                                       1460    1463      +3
applet_nameofs                                       728     730      +2
applet_install_loc                                   182     183      +1
dd_suffixes                                          112       -    -112
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 10/3 up/down: 337/-133)         Total: 204 bytes

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-22 17:56:38 +01:00
Ari Sundholm 8893023ba2 dd: move suffix struct to xatonum.c
This way it can be used by other applets without duplication.

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-22 17:41:04 +01:00
Denys Vlasenko 8dff01d06a libbb: introduce and use is_prefixed_with()
function                                             old     new   delta
is_prefixed_with                                       -      18     +18
complete_username                                     78      77      -1
man_main                                             737     735      -2
fsck_device                                          429     427      -2
unpack_ar_archive                                     80      76      -4
strip_unsafe_prefix                                  105     101      -4
singlemount                                         1054    1050      -4
rtc_adjtime_is_utc                                    90      86      -4
resolve_mount_spec                                    88      84      -4
parse_one_line                                      1029    1025      -4
parse_conf                                          1460    1456      -4
may_wakeup                                            83      79      -4
loadkmap_main                                        219     215      -4
get_irqs_from_stat                                   103      99      -4
get_header_cpio                                      913     909      -4
findfs_main                                           79      75      -4
fbsplash_main                                       1230    1226      -4
load_crontab                                         776     771      -5
expand_vars_to_list                                 1151    1146      -5
date_main                                            881     876      -5
skip_dev_pfx                                          30      24      -6
make_device                                         2199    2193      -6
complete_cmd_dir_file                                773     767      -6
run_applet_and_exit                                  715     708      -7
uudecode_main                                        321     313      -8
pwdx_main                                            197     189      -8
execute                                              568     560      -8
i2cdetect_main                                      1186    1176     -10
procps_scan                                         1242    1230     -12
procps_read_smaps                                   1017    1005     -12
process_module                                       746     734     -12
patch_main                                          1903    1891     -12
nfsmount                                            3572    3560     -12
stack_machine                                        126     112     -14
process_timer_stats                                  449     435     -14
match_fstype                                         111      97     -14
do_ipaddr                                           1344    1330     -14
open_list_and_close                                  359     343     -16
get_header_tar                                      1795    1779     -16
prepend_new_eth_table                                340     323     -17
fsck_main                                           1811    1794     -17
find_iface_state                                      56      38     -18
dnsd_main                                           1321    1303     -18
base_device                                          179     158     -21
find_keyword                                         104      82     -22
handle_incoming_and_exit                            2785    2762     -23
parse_and_put_prompt                                 774     746     -28
modinfo                                              347     317     -30
find_action                                          204     171     -33
update_passwd                                       1470    1436     -34
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/49 up/down: 18/-540)         Total: -522 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-12 17:48:34 +01:00
Stephen Heumann 7d8853ba3f Bump version to 1.1.
Also bump corresponding BusyBox version to 1.23.1, since it has no relevant changes over 1.23.0.
2015-02-07 20:12:55 -06:00
Denys Vlasenko 23cfaab47d libpwdgrp: use getpwent() instead of getpwent_r()
function                                             old     new   delta
massage_data_for_non_r_func                            -      90     +90
bb_internal_getpwent                                   -      69     +69
getXXnam_r                                            94     162     +68
fill_bounds                                          131     128      -3
deluser_main                                         355     310     -45
complete_username                                    123      78     -45
getXXnam                                             163      90     -73
massage_data_for_r_func                              103       -    -103
bb_internal_getpwent_r                               121       -    -121
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 1/5 up/down: 227/-407)         Total: -163 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-07 21:21:02 +01:00
Denys Vlasenko f7f70bf1b3 gzip: speed up and shrink put_16bit()
function                                             old     new   delta
put_16bit                                            104      98      -6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-02 16:07:07 +01:00
Denys Vlasenko 5104645cf8 platform.h: enable mempcpy for FreeBSD
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-02 03:51:47 +01:00
Denys Vlasenko 08f9ffc3f7 dpkg: update supported compression methods
Based on a patch by Ron Yorston <rmy@tigress.co.uk>

function                                             old     new   delta
get_header_tar_xz                                      -      60     +60
filter_accept_list_reassign                          128     188     +60
unpack_package                                       585     621     +36
init_archive_deb_control                              52      76     +24
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 3/0 up/down: 180/0)             Total: 180 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-30 15:15:38 +01:00
Denys Vlasenko 8c05a74f7e platform.h: mempcpy needs <string.h>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-29 16:41:48 +01:00
Stephen Heumann ad96f52394 Bump version to 1.0. 2015-01-25 16:11:15 -06:00
Denys Vlasenko 50a6d86520 platform.h: add compat mempcpy
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-25 22:08:46 +01:00
Stephen Heumann 6276d32088 Bump version number 2015-01-17 19:40:20 -06:00
Denys Vlasenko da9212667c libbb: code shrink by factoring out common update_utmp_DEAD_PROCESS
function                                             old     new   delta
update_utmp_DEAD_PROCESS                               -      17     +17
telnetd_main                                        1685    1674     -11
mark_terminated                                       56      45     -11
handle_sigchld                                        74      63     -11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-05 15:37:58 +01:00
Stephen Heumann b1044cfa8f Properly report exit status values with the high bit set (128-255).
These were being reported as strange values because the WEXITSTATUS macro from the GNO headers would erroneously sign-extend them.

Thanks to Kelvin Sherlock for posting an example that demonstrated this problem.
2015-01-04 15:45:25 -06:00
Denys Vlasenko 908b6e5dfd libpwdgrp: use FAST_FUNC to make "matching ABI" optimization more likely to succeed
See bb_internal_get*nam_r size reduction:

function                                             old     new   delta
bb_internal_getpwent_r                               167     176      +9
getXXnam_r                                           204     206      +2
sulogin_main                                         326     325      -1
su_main                                              471     470      -1
read_line_input                                     3832    3831      -1
print_stat                                           865     864      -1
prepare_socket_fd                                    283     282      -1
load_crontab                                         777     776      -1
fork_job                                             456     455      -1
do_shm                                               884     883      -1
do_sem                                               637     636      -1
do_msg                                               783     782      -1
complete_username                                    124     123      -1
bb_internal_getgrouplist                              71      70      -1
xgetpwuid                                             27      25      -2
xgetpwnam                                             27      25      -2
xgetgrnam                                             27      25      -2
xgetgrgid                                             27      25      -2
uid2uname                                             18      16      -2
login_main                                           980     978      -2
gid2group                                             18      16      -2
get_shell_name                                        54      52      -2
change_identity                                       50      48      -2
bb_internal_initgroups                                50      48      -2
argstr                                              1261    1259      -2
print_perms                                          177     174      -3
inetd_main                                          2077    2074      -3
run_applet_no_and_exit                               446     442      -4
fileaction_setowngrp                                  89      85      -4
deluser_main                                         312     308      -4
bb_internal_getpwuid                                  19      15      -4
bb_internal_getpwnam                                  11       7      -4
bb_internal_getgrnam                                  14      10      -4
bb_internal_getgrgid                                  19      15      -4
adduser_main                                         865     861      -4
passwd_main                                          989     984      -5
get_passwd                                            97      92      -5
data_extract_all                                     887     882      -5
check_user_passwd                                    490     485      -5
get_groups                                            81      75      -6
ftpd_main                                           2178    2171      -7
bb_internal_getspnam_r                                42      18     -24
bb_internal_getpwnam_r                                39      15     -24
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/41 up/down: 11/-153)         Total: -142 bytes
   text	   data	    bss	    dec	    hex	filename
 923167	    928	  17676	 941771	  e5ecb	busybox_old
 923023	    928	  17676	 941627	  e5e3b	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-02 22:31:07 +01:00
Tito Ragusa 1da09cfacf libpwdgrp: rewritten to use malloced implementation
This removed buffer size limitations.

function                                             old     new   delta
convert_to_struct                                      -     269    +269
getXXnam_r                                             -     204    +204
parse_common                                           -     185    +185
getXXnam                                               -     164    +164
tokenize                                               -     126    +126
bb_internal_getpwent_r                               102     167     +65
get_S                                                 30      88     +58
getgrouplist_internal                                195     240     +45
const_sp_db                                            -      20     +20
const_pw_db                                            -      20     +20
const_gr_db                                            -      20     +20
bb_internal_endpwent                                  27      36      +9
bb_internal_endgrent                                  27      36      +9
decode_one_format                                    726     734      +8
bb_internal_setpwent                                  17      24      +7
volume_id_probe_iso9660                              319     322      +3
scriptreplay_main                                    204     207      +3
mkfs_minix_main                                     2684    2687      +3
id_main                                              478     480      +2
hash_find                                            233     235      +2
pstree_main                                          321     322      +1
gr_off                                                 3       4      +1
expand_one_var                                      1579    1578      -1
pwf                                                    4       -      -4
grf                                                    4       -      -4
pack_gzip                                           1787    1780      -7
addattr32                                             67      56     -11
buffer_fill_and_print                                191     178     -13
dpkg_main                                           2944    2927     -17
bb_internal_setgrent                                  17       -     -17
bb_internal_getpwuid                                  38      19     -19
bb_internal_getgrgid                                  44      19     -25
bb_internal_getpwnam                                  38      11     -27
bb_internal_getgrnam                                  44      14     -30
bb_internal_fgetpwent_r                               51       -     -51
bb_internal_fgetgrent_r                               51       -     -51
bb_internal_getspnam_r                               121      42     -79
bb_internal_getpwnam_r                               121      39     -82
bb_internal_getgrent_r                               102       -    -102
bb__parsepwent                                       110       -    -110
bb_internal_getpwuid_r                               113       -    -113
bb_internal_getgrgid_r                               113       -    -113
bb__parsespent                                       120       -    -120
bb_internal_getgrnam_r                               121       -    -121
bb__pgsreader                                        213       -    -213
bb__parsegrent                                       226       -    -226
------------------------------------------------------------------------------
(add/remove: 8/13 grow/shrink: 14/11 up/down: 1224/-1556)    Total: -332 bytes
   text	   data	    bss	    dec	    hex	filename
 923471	    928	  17684	 942083	  e6003	busybox_old
 923167	    928	  17676	 941771	  e5ecb	busybox_unstripped

Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-02 21:37:59 +01:00
Stephen Heumann ba2aa925bc Fix sigaddset/sigdelset/sigismember macros to support signals above 16.
The versions in the GNO 2.0.6 headers are broken--they don't account for int being 16-bit, so they cut off the higher signals.
2014-12-28 16:06:45 -06:00
Stephen Heumann 70ea37208b Merge with BusyBox 1.23.0.
The only substantive change is about when simple line input mode is used.

I also bumped the version number and included a GNO-version-specific component.
2014-12-27 13:33:41 -06:00
Stephen Heumann 3e96c3390f Check for TERM changes every time we read input.
Also, fix possible crashes when termcap entries aren't found.
2014-12-24 14:54:06 -06:00
Peter Kümmel a6588fa102 Make it possible to override LOGIN_FAIL_DELAY in CONFIG_EXTRA_CFLAGS
Signed-off-by: Peter Kümmel <syntheticpp@gmx.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-22 01:55:54 +01:00
Stephen Heumann 038f37f9eb Enable "fancy echo," including echo -n and -e options. 2014-12-10 18:56:14 -06:00
Denys Vlasenko b4c11c1397 libarchive: add capability to unpack to mem.buffer
The performance and number of processes for a "depmod -a" with gzipped
modules was abysmal. This patch adds a code path without fork,
benefiting all users of xmalloc_open_zipped_read_close.

"modinfo radeon.ko.gz", a single-file reader, got 30% faster.
"depmod -a", which used to fork over 800 times, got 20% faster.

Heavily based on a patch by Lauri Kasanen <curaga@operamail.com>

function                                             old     new   delta
setup_transformer_on_fd                                -     159    +159
transformer_write                                      -     122    +122
fork_transformer                                       -     112    +112
xmalloc_open_zipped_read_close                        63     118     +55
read_bunzip                                         1866    1896     +30
xtransformer_write                                     -      19     +19
unzip_main                                          2449    2462     +13
bbunpack                                             755     766     +11
unpack_lzma_stream                                  2717    2723      +6
unpack_xz_stream                                    2393    2397      +4
unpack_Z_stream                                     1173    1175      +2
inflate_unzip                                        111     105      -6
check_signature16                                     70      63      -7
unpack_bz2_stream                                    359     349     -10
unpack_unxz                                           12       -     -12
unpack_unlzma                                         12       -     -12
unpack_uncompress                                     12       -     -12
unpack_gunzip                                         12       -     -12
unpack_bunzip2                                        12       -     -12
open_transformer                                     106      92     -14
inflate_unzip_internal                              1945    1916     -29
unpack_gz_stream                                     693     655     -38
open_zipped                                           89      47     -42
setup_unzip_on_fd                                    142      53     -89
------------------------------------------------------------------------------
(add/remove: 4/5 grow/shrink: 7/8 up/down: 533/-295)          Total: 238 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-07 00:44:00 +01:00
Denys Vlasenko e7800f351a Rename transformer_aux_data_t -> transformer_state_t
No code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-07 00:42:49 +01:00
Stephen Heumann b4a362ef71 Make test report EXEC files (shell scripts) as executable. 2014-12-04 13:41:21 -06:00
Stephen Heumann 2d16296748 Work around an ORCA/C preprocessor bug that was causing shell conditionals not to work properly.
The bug is that an #if condition may be mis-evaluated if it immediately follows a use of a function-like macro. I also modified a couple other places that could possibly trigger the bug (including a possibly more reliable fix for the instance of this problem I worked around earlier in include/xatonum.h).
2014-12-04 11:42:48 -06:00
Stephen Heumann fb9b298ca4 Implement "close-on-exec" functionality for GNO.
We do this by maintaining a mask (for each pid) giving the fds to be closed on exec. We wrap functions that close fds so that their close-on-exec bits can be cleared at that point.

This implementation may close the fds even if the execve operation ultimately fails.
2014-12-03 21:04:46 -06:00
Stephen Heumann 7b989fb6bc Work around a preprocessor bug that was causing an inappropriate version of many of the xatonum functions to be included in every object file. 2014-12-02 18:57:45 -06:00
Denys Vlasenko 04c1417602 libbb: use ARG_MAX for bb_arg_max() only if it's 60k+
Sometimes ARG_MAX is small (like 32k) yet sysconf(_SC_ARG_MAX)
is big, and people prefer using the bigger value.

OTOH, with sufficiently large ARG_MAX, further wins from
sysconf(_SC_ARG_MAX) being bigger are exponentially smaller:
you can see 4 times fewer fork+execs when you run find, but
when each execed process already takes a thousand parameters
it's likely execution time is dominated by what that process
does with each parameter.

Thus, with this change ARG_MAX is used if it's sufficiently big,
otherwise sysconf(_SC_ARG_MAX) is used.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-11-26 15:17:59 +01:00
Stephen Heumann 334678c6e9 Change various uses of signal masks to use 32-bit values (previously half the signals were essentially cut off). 2014-11-25 17:43:14 -06:00
Stephen Heumann 5c972aa397 Fix our handling of process groups for job control, working around a couple GNO bugs.
*Most significantly, we avoid using setpgid(), because it doesn't work and in fact corrupts the kernel's process group table.
*Also, work around tctpgrp() returning garbage instead of 0 on success.

This adds an implementation of tcsetpgrp that works by reading the process tables to find a process in the appropriate group. This isn't used for the main job control operations, though, since it might be relatively slow.

At this point, basic job control seems to work.
2014-11-21 23:05:38 -06:00
Stephen Heumann 62d8398fcf Fix to assign valid pgrps to child processes. On GNO, we can't just use the pid as a pgrp; we must call tcnewpgrp instead. 2014-11-20 17:53:33 -06:00
Stephen Heumann 4d60cd1043 Fixes for environment variable handling on GNO:
* Push/pop environment to make sure it is isolated from our parents and children.
* Make all environment vars (and shell vars) case-insensitive, consistent with GNO's internal handling of environment vars.
* Wrap putenv and unsetenv to make sure they are called with lower-case variable names, which is necessary to maintain consistency between the environ array and the kernel's internal representation of variables.
2014-11-20 13:21:23 -06:00
Stephen Heumann 078f526df7 Fixes for terminal behavior on the GNO console 2014-11-19 12:52:05 -06:00