summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer2007-01-09 15:46:36 +0000
committerBernhard Reutner-Fischer2007-01-09 15:46:36 +0000
commit8fc4011992a022536abd2790c99ec13be14a2f4f (patch)
treee2ce7fa59a3f2361ab637933321a9d30aefafa4c
parentf07fe62d899b964dac7941660c56c5451ae2e594 (diff)
downloadbusybox-8fc4011992a022536abd2790c99ec13be14a2f4f.zip
busybox-8fc4011992a022536abd2790c99ec13be14a2f4f.tar.gz
- 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
-rw-r--r--sysklogd/klogd.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/sysklogd/klogd.c b/sysklogd/klogd.c
index 97b4191..d916878 100644
--- a/sysklogd/klogd.c
+++ b/sysklogd/klogd.c
@@ -37,20 +37,18 @@ static void klogd_signal(int sig ATTRIBUTE_UNUSED)
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 @@ int klogd_main(int argc, char **argv)
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 @@ int klogd_main(int argc, char **argv)
/* 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++;