diff options
| author | aldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-01-09 15:46:36 +0000 |
|---|---|---|
| committer | aldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-01-09 15:46:36 +0000 |
| commit | 4c4be51c117ac2ffc0168fd3b038b16fcfec23d7 (patch) | |
| tree | e2ce7fa59a3f2361ab637933321a9d30aefafa4c | |
| parent | 7a729cccacf672b896b4735cd2d50e913c394ec4 (diff) | |
| download | busybox-w32-4c4be51c117ac2ffc0168fd3b038b16fcfec23d7.tar.gz busybox-w32-4c4be51c117ac2ffc0168fd3b038b16fcfec23d7.tar.bz2 busybox-w32-4c4be51c117ac2ffc0168fd3b038b16fcfec23d7.zip | |
- 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
git-svn-id: svn://busybox.net/trunk/busybox@17205 69ca8d6d-28ef-0310-b511-8ec308f3f277
| -rw-r--r-- | sysklogd/klogd.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/sysklogd/klogd.c b/sysklogd/klogd.c index 97b419104..d916878bf 100644 --- a/sysklogd/klogd.c +++ b/sysklogd/klogd.c | |||
| @@ -37,20 +37,18 @@ static void klogd_signal(int sig ATTRIBUTE_UNUSED) | |||
| 37 | int klogd_main(int argc, char **argv) | 37 | int klogd_main(int argc, char **argv) |
| 38 | { | 38 | { |
| 39 | RESERVE_CONFIG_BUFFER(log_buffer, KLOGD_LOGBUF_SIZE); | 39 | RESERVE_CONFIG_BUFFER(log_buffer, KLOGD_LOGBUF_SIZE); |
| 40 | int console_log_level = console_log_level; /* for gcc */ | 40 | int i = i; /* silence gcc */ |
| 41 | int priority = LOG_INFO; | ||
| 42 | int i, n, lastc; | ||
| 43 | char *start; | 41 | char *start; |
| 44 | 42 | ||
| 45 | /* do normal option parsing */ | 43 | /* do normal option parsing */ |
| 46 | n = getopt32(argc, argv, "c:n", &start); | 44 | getopt32(argc, argv, "c:n", &start); |
| 47 | 45 | ||
| 48 | if (n & OPT_LEVEL) { | 46 | if (option_mask32 & OPT_LEVEL) { |
| 49 | /* Valid levels are between 1 and 8 */ | 47 | /* Valid levels are between 1 and 8 */ |
| 50 | console_log_level = xatoul_range(start, 1, 8); | 48 | i = xatoul_range(start, 1, 8); |
| 51 | } | 49 | } |
| 52 | 50 | ||
| 53 | if (!(n & OPT_FOREGROUND)) { | 51 | if (!(option_mask32 & OPT_FOREGROUND)) { |
| 54 | #ifdef BB_NOMMU | 52 | #ifdef BB_NOMMU |
| 55 | vfork_daemon_rexec(0, 1, argc, argv, "-n"); | 53 | vfork_daemon_rexec(0, 1, argc, argv, "-n"); |
| 56 | #else | 54 | #else |
| @@ -70,12 +68,16 @@ int klogd_main(int argc, char **argv) | |||
| 70 | klogctl(1, NULL, 0); | 68 | klogctl(1, NULL, 0); |
| 71 | 69 | ||
| 72 | /* Set level of kernel console messaging.. */ | 70 | /* Set level of kernel console messaging.. */ |
| 73 | if (n & OPT_LEVEL) | 71 | if (option_mask32 & OPT_LEVEL) |
| 74 | klogctl(8, NULL, console_log_level); | 72 | klogctl(8, NULL, i); |
| 75 | 73 | ||
| 76 | syslog(LOG_NOTICE, "klogd started: %s", BB_BANNER); | 74 | syslog(LOG_NOTICE, "klogd started: %s", BB_BANNER); |
| 77 | 75 | ||
| 78 | while (1) { | 76 | while (1) { |
| 77 | int n; | ||
| 78 | int priority; | ||
| 79 | char lastc; | ||
| 80 | |||
| 79 | /* Use kernel syscalls */ | 81 | /* Use kernel syscalls */ |
| 80 | memset(log_buffer, '\0', KLOGD_LOGBUF_SIZE); | 82 | memset(log_buffer, '\0', KLOGD_LOGBUF_SIZE); |
| 81 | /* It will be null-terminted */ | 83 | /* It will be null-terminted */ |
| @@ -91,6 +93,7 @@ int klogd_main(int argc, char **argv) | |||
| 91 | /* klogctl buffer parsing modelled after code in dmesg.c */ | 93 | /* klogctl buffer parsing modelled after code in dmesg.c */ |
| 92 | start = &log_buffer[0]; | 94 | start = &log_buffer[0]; |
| 93 | lastc = '\0'; | 95 | lastc = '\0'; |
| 96 | priority = LOG_INFO; | ||
| 94 | for (i = 0; i < n; i++) { | 97 | for (i = 0; i < n; i++) { |
| 95 | if (lastc == '\0' && log_buffer[i] == '<') { | 98 | if (lastc == '\0' && log_buffer[i] == '<') { |
| 96 | i++; | 99 | i++; |
