svn commit: trunk/busybox/sysklogd

aldot at busybox.net aldot at busybox.net
Tue Jan 9 15:46:38 UTC 2007


Author: aldot
Date: 2007-01-09 07:46:36 -0800 (Tue, 09 Jan 2007)
New Revision: 17205

Log:
- shrink klogd a tiny bit.
  Compile tested only, would have sent it to the list for review but they don't show up in the ML archives :-/
   text    data     bss     dec     hex filename
    533       0       0     533     215 sysklogd/klogd.o.orig
    530       0       0     530     212 sysklogd/klogd.o


Modified:
   trunk/busybox/sysklogd/klogd.c


Changeset:
Modified: trunk/busybox/sysklogd/klogd.c
===================================================================
--- trunk/busybox/sysklogd/klogd.c	2007-01-09 10:06:19 UTC (rev 17204)
+++ trunk/busybox/sysklogd/klogd.c	2007-01-09 15:46:36 UTC (rev 17205)
@@ -37,20 +37,18 @@
 int klogd_main(int argc, char **argv)
 {
 	RESERVE_CONFIG_BUFFER(log_buffer, KLOGD_LOGBUF_SIZE);
-	int console_log_level = console_log_level; /* for gcc */
-	int priority = LOG_INFO;
-	int i, n, lastc;
+	int i = i; /* silence gcc */
 	char *start;
 
 	/* do normal option parsing */
-	n = getopt32(argc, argv, "c:n", &start);
+	getopt32(argc, argv, "c:n", &start);
 
-	if (n & OPT_LEVEL) {
+	if (option_mask32 & OPT_LEVEL) {
 		/* Valid levels are between 1 and 8 */
-		console_log_level = xatoul_range(start, 1, 8);
+		i = xatoul_range(start, 1, 8);
 	}
 
-	if (!(n & OPT_FOREGROUND)) {
+	if (!(option_mask32 & OPT_FOREGROUND)) {
 #ifdef BB_NOMMU
 		vfork_daemon_rexec(0, 1, argc, argv, "-n");
 #else
@@ -70,12 +68,16 @@
 	klogctl(1, NULL, 0);
 
 	/* Set level of kernel console messaging.. */
-	if (n & OPT_LEVEL)
-		klogctl(8, NULL, console_log_level);
+	if (option_mask32 & OPT_LEVEL)
+		klogctl(8, NULL, i);
 
 	syslog(LOG_NOTICE, "klogd started: %s", BB_BANNER);
 
 	while (1) {
+		int n;
+		int priority;
+		char lastc;
+
 		/* Use kernel syscalls */
 		memset(log_buffer, '\0', KLOGD_LOGBUF_SIZE);
 		/* It will be null-terminted */
@@ -91,6 +93,7 @@
 		/* klogctl buffer parsing modelled after code in dmesg.c */
 		start = &log_buffer[0];
 		lastc = '\0';
+		priority = LOG_INFO;
 		for (i = 0; i < n; i++) {
 			if (lastc == '\0' && log_buffer[i] == '<') {
 				i++;




More information about the busybox-cvs mailing list