hush: initial trap support

Mike Frysinger vapier at gentoo.org
Sun Mar 29 17:00:33 UTC 2009


On Sunday 29 March 2009 11:24:10 Denys Vlasenko wrote:
> (a) I prefer all data to go to struct globals, never to .data.
> (b) It would be nice to allocate it on first use, it's big
>     (so that scripts which never use traps don't waste memory for it).
> (c) int sig; const char *name; is wasting 8 bytes,
>     uint8_t sig; char name[7]; is more compact.
> (d) libbb has get_signum(str) which already does signal name or number ->
>     signal number conversion. get_signame(num) is an opposite convertor.
>     Use them, this allows you to not duplicate signal names.

using the common sig funcs to do translation allows for quite a bit of 
reduction.  delaying the alloc also saves on bloat.  i was hoping there was a 
way we could unify the code so that hush wouldnt have to save/restore the 
sigaction at all though.  it'd know which ones hush wants to handle (like for 
CTRL+Z and CTRL+C) ... that may save on allocated data, but not really code, 
so maybe it isnt worth the hassle.

updated patch attached

> Add a comment somewhere that we improperly execute traps at once
> (even within, say, malloc() calls... which is rather bad)
> while we need to wait for latest command completion.

i dont follow you here ... no idea what you're talking about actually :)
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hush-trap.patch
Type: text/x-patch
Size: 5994 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090329/4923d35f/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090329/4923d35f/attachment-0001.pgp>


More information about the busybox mailing list