[BusyBox] [PATCH] size optimisation for fdformat.c

Glenn McGrath bug1 at iinet.net.au
Tue Jan 20 13:32:34 UTC 2004


On Mon, 19 Jan 2004 14:47:59 +0000
Tito <farmatito at tiscali.it> wrote:

> Hi to all,

> I tested it several times with fd0 and fd0u1722 and it worked well.

Applied.


> BTW I would like to ask the Gurus if it is possible to move the
> following two functions to libbb ( as they are or improved/cleaned
> up):

It probably is a good idea, on a related note....

There are times when it would be convenient to use one of the xfunctions
in libbb but the exit status, or message logging isnt suitable.

I think it would be good if we could modify the exit and
logging behaviour of the various xfuncs.

It could eliminate the need for seperate functions such as this proposed
bb_xioctl() and bb_ioctl(), xfopen() and wfopen() and bb_xgetularg could
be more generally usefull if it didnt call bb_show_usage on error.

Also, many of these xfuncts are problematic in inetd as they need to
send error messages to syslog instead of stderr. 

Most of these xfunctions are really small, they do not justify adding
extra code to handle different error handling or exit status, that is
why there is multiple versions of them with slightly different
behaviour.

A different approach would be to add extra functionality to
bb_error_msg, perhaps adding a global variable that offers different
error logging and exit behaviour.

We could use a bitfield seperated to two groups, e.g.

ERROR_MSG_STDERR
ERROR_MSG_SYSLOG
ERROR_MSG_SILENT

ERROR_DIE
ERROR_RETURN
ERROR_SHOW_USAGE

(there may be others)

bb_error_msg is one of the most common functions we have so adding extra
functionality would add little overhead and would probably lead to a
reduction in the number of libbb functions and make the remaining ones
more usfull.

Opinions ?



Glenn



More information about the busybox mailing list