Commit Graph

43 Commits

Author SHA1 Message Date
Denys Vlasenko
ebe6d9d875 whitespace and comment format fixes, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-10-05 14:40:24 +02:00
Johannes Schindelin
e5b1f5af73 copyfd: guard use of munmap() with #if (windows builds need this)
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-15 11:44:13 +02:00
Bartosz Golaszewski
8d75d794ea libbb: use sendfile() to copy data between file descriptors
Busybox already uses sendfile in httpd. This patch proposes to use it
globally to copy data between file descriptors.

It speeds up the copying on slow systems a lot - below are the times needed
to copy a 450Mb file with and without this option enabled on a BeagleBone
Black:

sendfile:
user    0m0.000s
sys     0m8.170s

read/write 4k:
user    0m0.470s
sys     0m16.300s

function                                             old     new   delta
bb_full_fd_action                                    394     474     +80

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-11-27 23:31:58 +01:00
Denys Vlasenko
0ef64bdb40 *: make GNU licensing statement forms more regular
This change retains "or later" state! No licensing _changes_ here,
only form is adjusted (article, space between "GPL" and "v2" and so on).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 20:14:46 +02:00
Denys Vlasenko
1eaf7e76bf libbb/copyfd.c: fix the case of copy buffer <= 4kb
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-26 23:08:59 +02:00
Denys Vlasenko
d0a8a0d312 tar: fix --to-command wrt short writes
function                                             old     new   delta
bb_copyfd_exact_size                                  51      98     +47
bb_full_fd_action                                    362     394     +32
get_header_tar                                      1546    1558     +12
data_extract_to_command                              430     439      +9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 100/0)             Total: 100 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-26 18:11:44 +02:00
Denys Vlasenko
bcda0042e2 libbb/copyfd.c: don't mmap a largish buffer if we only want to copy a few kb
function                                             old     new   delta
bb_full_fd_action                                    283     295     +12

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-19 14:34:30 +01: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
8003e266ed explain why we use mmap instead of malloc 2007-12-02 07:18:29 +00:00
Denis Vlasenko
4c13922961 Introduce FEATURE_COPYBUF_KB.
People who want smaller stack at any cost may use it
to reduce cp's stack usage (FEATURE_COPYBUF_KB=1).
Desktop people may get faster copy of big files
(FEATURE_COPYBUF_KB=32 is ~30% faster than 4kb)
2007-12-02 03:27:42 +00:00
Denis Vlasenko
50f7f446ec bb_full_fd_action: remove potential xmalloc from NOFORK path
cat: stop using stdio.h opens
libbb: introduce & use open[3]_or_warn
function                                             old     new   delta
open3_or_warn                                          -      54     +54
bb_cat                                               115     144     +29
open_or_warn                                           -      25     +25
unlzma                                              2404    2412      +8
chattr_main                                          334     339      +5
xstrtoul_range_sfx                                   251     255      +4
telnet_main                                         1514    1510      -4
static.opt                                             4       -      -4
qgravechar                                           122     118      -4
fuser_add_pid                                         61      54      -7
fuser_add_inode                                      154     147      -7
writeFileToTarball                                  1542    1534      -8
refresh                                             1156    1148      -8
do_show                                              856     846     -10
read_leases                                          212     200     -12
setup_redirects                                      236     222     -14
iproute_list_or_flush                               1582    1568     -14
read_config                                          427     411     -16
write_leases                                         284     264     -20
hash_file                                            338     318     -20
copy_file                                           1760    1740     -20
do_iproute                                          2610    2588     -22
bb_full_fd_action                                    320     269     -51
open_to_or_warn                                      103      49     -54
fuser_main                                          1660    1596     -64
.rodata                                           131160  131096     -64
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 4/19 up/down: 125/-423)        Total: -298 bytes
2007-04-11 23:20:53 +00:00
Denis Vlasenko
335b63d8d1 make a few struct bb_applet members conditional
rename sllep_and_die -> xfunc_die
make fflush_stdout_and_exit NOFORK-safe
fix some buglets found by randomconfig
2007-04-10 21:38:30 +00:00
Denis Vlasenko
99912ca733 audit small applets and mark some of them as NOFORK.
Put big scary warnings in relevant places.
2007-04-10 15:43:37 +00:00
Denis Vlasenko
3f3aa2a57d make xfunctions optionally longjump instead of exit.
use it for making NOFORK more practical.
touch: make it a NOFORK applet
2007-04-09 21:35:07 +00:00
Denis Vlasenko
f7996f3b70 Trailing whitespace removal over entire tree 2007-01-11 17:20:00 +00:00
Denis Vlasenko
714701c890 tar et al: die if bb_copyfd_size copies less than asked for.
(we have bb_copyfd_exact_size now for that kind of usage)
2006-12-22 00:21:07 +00:00
Denis Vlasenko
2d27e4ccbb tee: fix bug: argv[-1] is a no-no!
bb_full_fd_action: optimize
die_if_ferror: "<applet>: filename" isn't a good err msg, add "..I/O error"
2006-11-25 23:50:28 +00:00
Denis Vlasenko
4fbb584a0e tar: cry murder and bail out if file shrinks under us while we tar it up 2006-11-24 14:55:23 +00:00
Denis Vlasenko
7039a66b58 correct largefile support, add comments about it. 2006-10-08 17:54:47 +00:00
Denis Vlasenko
6231e870ec style fixes 2006-09-17 15:45:48 +00:00
Rob Landley
534374755d Cleaup read() and write() variants, plus a couple of new functions like
xlseek and fdlength() for the new mkswap.
2006-07-16 08:14:35 +00:00
Bernhard Reutner-Fischer
421d9e5941 - move buffer allocation schemes to libbb.h
- include the correct headers: applets need busybox.h while lib* need libbb.h
2006-04-03 16:39:31 +00:00
Rob Landley
dfba741457 Robert P. Day removed 8 gazillion occurrences of "extern" on function
definitions.  (That should only be on prototypes.)
2006-03-06 20:47:33 +00:00
Rob Landley
90632d021c Bug fix from Kim B. Heino, manifested via:
echo > foo && zip foo.zip foo && ./busybox unzip foo.zip
2006-02-13 19:40:43 +00:00
"Vladimir N. Oleynik"
7600eec732 avoid signed<->unsigned warning 2006-01-31 12:12:15 +00:00
Tim Riker
c1ef7bdd8d just whitespace 2006-01-25 00:08:53 +00:00
Rob Landley
9033453c18 My last change to this file broke tar x. Sigh. (Trying to make sure we work
on file sizes between 2 and 4 gigs on 32 bit machines.  For supporting >4 gigs,
just use a 64 bit machine already...)
2005-11-12 11:04:11 +00:00
Rob Landley
3fc4ad1478 Fix bug 424: doing full_read breaks things like cat which should return a
chunk of data when they get it and not block until they've buffered 4k.

The use case was cat /proc/psaux, but you can also reproduce this by
running non-busybox cat by itself and typing things at the command line.
Then run busybox cat.  Notice how cat is _supposed_ to echo each line back
to us as we hit enter?
2005-11-04 01:54:15 +00:00
Rob Landley
21ccbb6c0e When cp ran out of space it didn't return a nonzero error code. Fixes bug 493. 2005-11-04 01:20:46 +00:00
Eric Andersen
fef32b570b Correct errors preventing busybox tar from working properly,
fixing bug http://bugs.uclibc.org/view.php?id=231
2005-04-27 10:51:38 +00:00
Eric Andersen
451c0d2828 Rework to fix http://bugs.uclibc.org/view.php?id=107 2005-04-16 07:46:53 +00:00
Eric Andersen
c7bda1ce65 Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
Glenn L McGrath
181f0773e2 bb_full_fd_action was incorrectly returning an error message causing
major breaking.
2004-02-23 08:11:07 +00:00
Glenn L McGrath
15c3512614 Sometimes i get carried away with the use of function pointers, im sure
it seemed like a good idea at the time.
2004-02-21 09:20:56 +00:00
Glenn L McGrath
c3498f678a When a size of 0 is passed to copyfd_size, dont do anything, it was
reading untill eof which breaks tar
2003-11-24 23:50:07 +00:00
Glenn L McGrath
f0515dad66 Fix warning 2003-11-22 02:13:41 +00:00
Glenn L McGrath
7ffe133864 As we no longer use function pointers for read in common archiving code
archive_xread can be replaced with bb_full_read, and archive_copy_file
with bb_copyfd*
bb_copyfd is split into two functions bb_copyfd_size and bb_copyfd_eof,
they share a common backend.
2003-11-21 22:24:57 +00:00
Eric Andersen
cb81e6484d Update a bunch of docs. Run a script to update my email addr. 2003-07-14 21:21:08 +00:00
Manuel Novoa III
cad5364599 Major coreutils update. 2003-03-19 09:13:01 +00:00
Glenn L McGrath
25fe94fd32 Merge copyfd and copy_file_chunk 2002-12-13 08:20:44 +00:00
Eric Andersen
bdfd0d78bc Major rework of the directory structure and the entire build system.
-Erik
2001-10-24 05:00:29 +00:00
Matt Kraai
d6ef07406d Rewrote copyfd to use library functions, terminate, and copy correct data. 2001-05-18 14:14:55 +00:00
Eric Andersen
55f9872616 This patch from Adam Heath <doogie@debian.org>, makes print_file
(used by cat, grep, sed, etc) quite a bit faster.
2001-05-15 17:48:09 +00:00