[PATCH RESEND] new bb_msg_and_syslog + sulogin clean up.

Tito farmatito at tiscali.it
Wed Aug 23 10:26:03 UTC 2006


Hi,
this set of patches (2) contains a new bb_msg_and_syslog
function for libbb  and shows the use of this new function in the sulogin applet.

bb_msg_and_syslog:
	This function opens a connection to the system logger for a  program.
	The facility value is set through a global variable bb_facility as it 
	is changed just one time per applet and so we spare one argument.
	it then generates a log message and closes the descriptor
	if ENABLE_FEATURE_CLEAN_UP is set.
	The function generates also a message:
			if level is:   LOG_INFO, LOG_NOTICE 
							the message will not contain the applet's name and 
							goes to stdout;
			if level is:  LOG_DEBUG (only if CONFIG_DEBUG is set), LOG_WARNING 
							the message will contain the applet's name and 
							goes to stderr;
			if level is:  LOG_ERR,  LOG_CRIT, LOG_ALERT, LOG_EMERG  
							the message will contain the applet's name and 
							goes to stderr, after printing this message 
							the progam will exit with a return value of EXIT_FAILURE.

	You can disable messages by adding LOG_QUIET (100) to the other LOG_* values.

	So by choosing an appropriate level value we can influence the behaviour
	of the function.

Bloat-o-meter values are: 
function                                             old     new   delta
bb_msg_and_syslog                          -     179    +179
bb_facility                                            -          4        +4
spf                                                       4        -            -4
setspent                                           17       -          -17
endspent                                          27       -          -27
getspent_r                                        97       -          -97
sulogin_main                                  709    455     -254
------------------------------------------------------------------------------
(add/remove: 2/4 grow/shrink: 0/1 up/down: 183/-399)         Total: -216 bytes


Comments, reviews and critics are welcome.
Apply if you like them.  ;-)

Ciao,
Tito
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bb_syslog.patch
Type: text/x-diff
Size: 3335 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20060823/bef41aa5/attachment-0004.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sulogin02.patch
Type: text/x-diff
Size: 4426 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20060823/bef41aa5/attachment-0005.bin 


More information about the busybox mailing list