Commit Graph

32 Commits

Author SHA1 Message Date
Rasmus Villemoes
656ca7bdd9 libbb/u_signal_names.c: don't check errno after bb_strtou
Since we're comparing the return value to a smallish integer anyway, we
might as well use that bb_strtou() returns UINT_MAX for malformed
input. Referencing errno is kinda bloaty on glibc.

While NSIG is not in POSIX, we do already rely on it being defined,
compile-time const and smallish, since arrays in struct globals_misc are
defined in terms of it.

function                                             old     new   delta
get_signum                                           312     286     -26

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-10-31 11:28:37 +01:00
Rasmus Villemoes
571e525a14 libbb: optionally honour libc provided SIGRTMIN/SIGRTMAX in get_signum()
When an application documents that it responds such and such to
SIGRTMIN+n, that almost always means with respect to the libc-provided
SIGRTMIN. Hence I disagree with the "more correct" in commit
7b276fc175. In any case, this is rather unfortunate:

36
34

(the first shell is bash). We probably can't change default behaviour
after 7 years, but at least we can provide a config option.

We avoid a little code generation (repeated calls to
__libc_current_sigrtmin) by stashing SIGRTMIN/SIGRTMAX in local
variables, but it does cost ~50 bytes. The next patch serves as penance
for that.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-10-31 11:13:55 +01:00
Denys Vlasenko
0c4dbd481a regularize format of source file headers, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-09-18 16:28:43 +02:00
Denys Vlasenko
86981e3ad2 ash: allow "trap NUM [SIG]..." syntax
While at it, make get_signum() return -1 for numeric strings >= NSIG.

function                                             old     new   delta
trapcmd                                              292     306     +14
get_signum                                           295     300      +5
builtin_trap                                         413     412      -1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 19/-1)              Total: 18 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-25 20:06:17 +02:00
Denys Vlasenko
72089cf6b4 config: deindent all help texts
Those two spaces after tab have no effect, and always a nuisance when editing.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-21 09:50:55 +02:00
Denys Vlasenko
3e134ebf6a *: slap on a few ALIGN1/2s where appropriate
The result of looking at "grep -F -B2 '*fill*' busybox_unstripped.map"

   text	   data	    bss	    dec	    hex	filename
 829901	   4086	   1904	 835891	  cc133	busybox_before
 829665	   4086	   1904	 835655	  cc047	busybox

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-22 18:09:21 +02:00
Denys Vlasenko
327d2885ec kill[all[5]],pkill: make signal list show signal numbers, and show RTMIN/MAX
function                                             old     new   delta
print_signames                                        31      64     +33
signals                                              224     231      +7

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-01-03 13:08:58 +01:00
Denys Vlasenko
7b276fc175 kill[all[5]],pkill: more correct, and smaller, SIGRTMIN/MAX code
function                                             old     new   delta
__libc_current_sigrtmin                                6       -      -6
__libc_current_sigrtmax                                6       -      -6
get_signum                                           339     295     -44
------------------------------------------------------------------------------
(add/remove: 0/3 grow/shrink: 0/1 up/down: 0/-56)             Total: -56 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-01-03 12:51:13 +01:00
Denys Vlasenko
2753aae0e8 libbb: optionally support RTMIN[+n] and RTMAX[-n] signal names
function                                             old     new   delta
get_signum                                           140     336    +196
__libc_allocate_rtsig                                  -      56     +56
__libc_current_sigrtmin                                -       6      +6
__libc_current_sigrtmax                                -       6      +6
current_rtmin                                          -       4      +4
current_rtmax                                          -       4      +4
bbconfig_config_bz2                                 4961    4962      +1
------------------------------------------------------------------------------
(add/remove: 6/0 grow/shrink: 2/0 up/down: 273/0)             Total: 273 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-30 01:17:03 +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
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
6b06cb80be more of -Wall fixes from Cristian Ionescu-Idbohrn.
Some are fixing real bugs.

function                                             old     new   delta
syslogd_main                                         938     958     +20
get_signum                                           136     143      +7
obj_load                                             777     782      +5
recv_from_to                                         210     214      +4
get_next_block                                      1795    1799      +4
display_topmem_process_list                         1117    1121      +4
logread_main                                         484     487      +3
buffer_fill_and_print                                 73      76      +3
kill_main                                            687     689      +2
ll_remember_index                                    240     241      +1
do_stats                                             452     453      +1
if_readconf                                          166     165      -1
display_process_list                                1192    1191      -1
run_applet_and_exit                                  507     505      -2
print_signames                                        33      31      -2
parse_one_line                                      1092    1090      -2
find_out_spec                                         57      55      -2
add_ksymoops_symbols                                 421     419      -2
ash_main                                            1407    1402      -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 11/8 up/down: 54/-17)            Total: 37 bytes
2008-05-15 21:30:45 +00:00
Denis Vlasenko
77ad97f199 more -Wall warning fixes from Cristian Ionescu-Idbohrn.
This time it resulted in small code changes:

function                                             old     new   delta
nexpr                                                820     828      +8
tail_main                                           1200    1202      +2
wrapf                                                166     167      +1
parse_mount_options                                  227     209     -18
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 11/-18)             Total: -7 bytes
2008-05-13 02:27:31 +00:00
Denis Vlasenko
b851c42a14 signal names hack was wrong, it broke "get signal name" function.
Reverting :(
2007-12-04 21:44:52 +00:00
Denis Vlasenko
c689fcfdb0 Make signal table a bit smaller
get_signum                                           136     151     +15
signals                                              224     192     -32
2007-12-04 10:20:48 +00:00
Denis Vlasenko
5f934b0785 guard against SIGxxx >= 32 (no code changes on i386) 2007-12-04 10:05:28 +00:00
Denis Vlasenko
a4f4de9b7e print_signames_and_exit -> print_signames (because of "ash calls kill_main") 2007-09-30 16:32:01 +00:00
Denis Vlasenko
72e1c89d97 pgrep,pkill: new applets by Loic Grenie <loic.grenie@gmail.com> 2007-09-29 22:26:01 +00:00
Denis Vlasenko
80b8b39899 Consolidate ARRAY_SIZE macro; remove one unneeded global var (walter harms <wharms@bfs.de>) 2007-06-25 10:55:35 +00:00
Denis Vlasenko
dcf4de20a1 test: code size saving, no logic changes
ps: fix warning, make a bit smaller
kill -l: make smaller & know much more signals

function                                             old     new   delta
get_signum                                           121     153     +32
kill_main                                            826     843     +17
get_signame                                           44      36      -8
signals                                              252     224     -28
.rodata                                           131955  131923     -32
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/3 up/down: 49/-68)            Total: -19 bytes
2007-05-01 20:07:29 +00:00
Denis Vlasenko
75ab6af71e stop using (yet another) static buffer 2007-03-14 21:56:51 +00:00
Denis Vlasenko
2a813e20e2 fix recognitions of -SIGname signals
(fix by Jacques LUDER <jacques.luder@thalesgroup.com>)
2006-12-23 01:06:21 +00:00
Bernhard Reutner-Fischer
bbda98f14c - cosmetic change to avoid warnings about eventual padding/packing. 2006-12-04 15:58:27 +00:00
Denis Vlasenko
a77947f5bb kill: fix bugs (kill -l output was horrible), fix style, constify data 2006-09-27 14:19:16 +00:00
Denis Vlasenko
9213a9e0f2 whitespace cleanup 2006-09-17 16:28:10 +00:00
Rob Landley
c9c1a41c58 A couple things that got tangled up in my tree, easier to check in both than
untangle them:

Rewrite u_signal_names() into get_signum() and get_signame(), plus trim the
signal list to that required by posix (they can specify the numbers for
the rest if they really need them).  (This is preparatory cleanup for adding
a timeout applet like Roberto Foglietta wants.)

Export the itoa (added due to Denis Vlasenko, although it's not quite his
preferred implementation) from xfuncs.c so it's actually used, and remove
several other redundant implementations of itoa and utoa() in the tree.
2006-07-12 19:17:55 +00:00
Bernhard Reutner-Fischer
a2a647dfc1 - include strings.h
Thanks to Rich Felker for pointing this out.
2006-05-19 12:30:00 +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
Eric Andersen
c7bda1ce65 Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +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
Eric Andersen
bdfd0d78bc Major rework of the directory structure and the entire build system.
-Erik
2001-10-24 05:00:29 +00:00
Eric Andersen
842757dc96 Oops. I forgot to commit this part of vodz' patch. 2001-08-02 05:18:55 +00:00