diff options
Diffstat (limited to 'sysklogd')
-rw-r--r-- | sysklogd/syslogd.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index 1f3e31225..24c721f8e 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c | |||
@@ -62,6 +62,9 @@ static const char syslogd_usage[] = | |||
62 | "Options:\n" | 62 | "Options:\n" |
63 | "\t-m\tChange the mark timestamp interval. default=20min. 0=off\n" | 63 | "\t-m\tChange the mark timestamp interval. default=20min. 0=off\n" |
64 | "\t-n\tDo not fork into the background (for when run by init)\n" | 64 | "\t-n\tDo not fork into the background (for when run by init)\n" |
65 | #ifdef BB_KLOGD | ||
66 | "\t-K\tDo not start up the klogd process (by default syslogd spawns klogd).\n" | ||
67 | #endif | ||
65 | "\t-O\tSpecify an alternate log file. default=/var/log/messages\n"; | 68 | "\t-O\tSpecify an alternate log file. default=/var/log/messages\n"; |
66 | 69 | ||
67 | 70 | ||
@@ -251,6 +254,8 @@ static void doSyslogd(void) | |||
251 | close(fd); | 254 | close(fd); |
252 | } | 255 | } |
253 | 256 | ||
257 | #ifdef BB_KLOGD | ||
258 | |||
254 | static void klogd_signal(int sig) | 259 | static void klogd_signal(int sig) |
255 | { | 260 | { |
256 | ksyslog(7, NULL, 0); | 261 | ksyslog(7, NULL, 0); |
@@ -259,7 +264,6 @@ static void klogd_signal(int sig) | |||
259 | exit( TRUE); | 264 | exit( TRUE); |
260 | } | 265 | } |
261 | 266 | ||
262 | |||
263 | static void doKlogd(void) | 267 | static void doKlogd(void) |
264 | { | 268 | { |
265 | int priority=LOG_INFO; | 269 | int priority=LOG_INFO; |
@@ -325,11 +329,15 @@ static void doKlogd(void) | |||
325 | 329 | ||
326 | } | 330 | } |
327 | 331 | ||
332 | #endif | ||
328 | 333 | ||
329 | extern int syslogd_main(int argc, char **argv) | 334 | extern int syslogd_main(int argc, char **argv) |
330 | { | 335 | { |
331 | int pid, klogd_pid; | 336 | int pid, klogd_pid; |
332 | int doFork = TRUE; | 337 | int doFork = TRUE; |
338 | #ifdef BB_KLOGD | ||
339 | int startKlogd = TRUE; | ||
340 | #endif | ||
333 | char *p; | 341 | char *p; |
334 | char **argv1=argv; | 342 | char **argv1=argv; |
335 | 343 | ||
@@ -345,6 +353,11 @@ extern int syslogd_main(int argc, char **argv) | |||
345 | case 'n': | 353 | case 'n': |
346 | doFork = FALSE; | 354 | doFork = FALSE; |
347 | break; | 355 | break; |
356 | #ifdef BB_KLOGD | ||
357 | case 'K': | ||
358 | startKlogd = FALSE; | ||
359 | break; | ||
360 | #endif | ||
348 | case 'O': | 361 | case 'O': |
349 | if (--argc == 0) { | 362 | if (--argc == 0) { |
350 | usage(syslogd_usage); | 363 | usage(syslogd_usage); |
@@ -375,12 +388,16 @@ extern int syslogd_main(int argc, char **argv) | |||
375 | doSyslogd(); | 388 | doSyslogd(); |
376 | } | 389 | } |
377 | 390 | ||
391 | #ifdef BB_KLOGD | ||
378 | /* Start up the klogd process */ | 392 | /* Start up the klogd process */ |
379 | klogd_pid = fork(); | 393 | if (startKlogd == TRUE) { |
380 | if (klogd_pid == 0 ) { | 394 | klogd_pid = fork(); |
381 | strncpy(argv[0], "klogd", strlen(argv[0])); | 395 | if (klogd_pid == 0 ) { |
382 | doKlogd(); | 396 | strncpy(argv[0], "klogd", strlen(argv[0])); |
397 | doKlogd(); | ||
398 | } | ||
383 | } | 399 | } |
400 | #endif | ||
384 | 401 | ||
385 | exit( TRUE); | 402 | exit( TRUE); |
386 | } | 403 | } |