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

Vladimir N. Oleynik dzo at simtreas.ru
Tue Jan 20 13:54:17 UTC 2004


Glenn,

> 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 ?

Also have another method. Exampe crond logging.
The first char from formating have special case.
To standart stdio function puted with +1 offset.


--w
vodz





More information about the busybox mailing list