- 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
This commit is contained in:
parent
f07fe62d89
commit
8fc4011992
@ -37,20 +37,18 @@ static void klogd_signal(int sig ATTRIBUTE_UNUSED)
|
|||||||
int klogd_main(int argc, char **argv)
|
int klogd_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
RESERVE_CONFIG_BUFFER(log_buffer, KLOGD_LOGBUF_SIZE);
|
RESERVE_CONFIG_BUFFER(log_buffer, KLOGD_LOGBUF_SIZE);
|
||||||
int console_log_level = console_log_level; /* for gcc */
|
int i = i; /* silence gcc */
|
||||||
int priority = LOG_INFO;
|
|
||||||
int i, n, lastc;
|
|
||||||
char *start;
|
char *start;
|
||||||
|
|
||||||
/* do normal option parsing */
|
/* 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 */
|
/* 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
|
#ifdef BB_NOMMU
|
||||||
vfork_daemon_rexec(0, 1, argc, argv, "-n");
|
vfork_daemon_rexec(0, 1, argc, argv, "-n");
|
||||||
#else
|
#else
|
||||||
@ -70,12 +68,16 @@ int klogd_main(int argc, char **argv)
|
|||||||
klogctl(1, NULL, 0);
|
klogctl(1, NULL, 0);
|
||||||
|
|
||||||
/* Set level of kernel console messaging.. */
|
/* Set level of kernel console messaging.. */
|
||||||
if (n & OPT_LEVEL)
|
if (option_mask32 & OPT_LEVEL)
|
||||||
klogctl(8, NULL, console_log_level);
|
klogctl(8, NULL, i);
|
||||||
|
|
||||||
syslog(LOG_NOTICE, "klogd started: %s", BB_BANNER);
|
syslog(LOG_NOTICE, "klogd started: %s", BB_BANNER);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
int n;
|
||||||
|
int priority;
|
||||||
|
char lastc;
|
||||||
|
|
||||||
/* Use kernel syscalls */
|
/* Use kernel syscalls */
|
||||||
memset(log_buffer, '\0', KLOGD_LOGBUF_SIZE);
|
memset(log_buffer, '\0', KLOGD_LOGBUF_SIZE);
|
||||||
/* It will be null-terminted */
|
/* 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 */
|
/* klogctl buffer parsing modelled after code in dmesg.c */
|
||||||
start = &log_buffer[0];
|
start = &log_buffer[0];
|
||||||
lastc = '\0';
|
lastc = '\0';
|
||||||
|
priority = LOG_INFO;
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
if (lastc == '\0' && log_buffer[i] == '<') {
|
if (lastc == '\0' && log_buffer[i] == '<') {
|
||||||
i++;
|
i++;
|
||||||
|
Loading…
Reference in New Issue
Block a user