Contents of /tags/mkinitrd-6_3_4/busybox/docs/logging_and_backgrounding.txt
Parent Directory | Revision Log
Revision 1189 -
(show annotations)
(download)
Thu Dec 16 01:27:43 2010 UTC (13 years, 9 months ago) by niro
File MIME type: text/plain
File size: 4297 byte(s)
Thu Dec 16 01:27:43 2010 UTC (13 years, 9 months ago) by niro
File MIME type: text/plain
File size: 4297 byte(s)
tagged 'mkinitrd-6_3_4'
1 | Logging and backgrounding |
2 | |
3 | By default, bb_[p]error_msg[_and_die] messages go to stderr, |
4 | and of course, usually applets do not auto-background. :) |
5 | |
6 | Historically, daemons and inetd services are different. |
7 | |
8 | Busybox is trying to provide compatible behavior, thus if an applet |
9 | is emulating an existing utility, it should mimic it. If utility |
10 | auto-backgrounds itself, busybox applet should do the same. |
11 | If utility normally logs to syslog, busybox applet should do |
12 | the same too. |
13 | |
14 | However, busybox should not needlessly restrict the freedom |
15 | of the users. And users have different needs and different preferences. |
16 | Some might like logging everything from daemons to syslog. |
17 | Others prefer running stuff under runsv/svlogd and thus would like |
18 | logging to stderr and no daemonization. |
19 | |
20 | To help with that, busybox applets should have options to override |
21 | default behavior, whatever that is for a given applet. |
22 | |
23 | |
24 | Current situation is a bit of a mess: |
25 | |
26 | acpid - auto-backgrounds unless -d |
27 | crond - auto-backgrounds unless -f, logs to syslog unless -d or -L. |
28 | option -d logs to stderr, -L FILE logs to FILE |
29 | devfsd - (obsolete) |
30 | dnsd - option -d makes it background and log to syslog |
31 | fakeidentd - inetd service. Auto-backgrounds and logs to syslog |
32 | if no -f and no -i and no -w (-i is "inetd service" flag, |
33 | -w is "inetd-wait service" flag) |
34 | ftpd - inetd service. Logs to syslog with -S, with -v logs to strerr too |
35 | httpd - auto-backgrounds unless -f or -i (-i is "inetd service" flag) |
36 | inetd - auto-backgrounds unless -f, logs to syslog unless -e |
37 | klogd - auto-backgrounds unless -n |
38 | syslogd - auto-backgrounds unless -n |
39 | telnetd - auto-backgrounds unless -f or -i (-i is "inetd service" flag) |
40 | udhcpc - auto-backgrounds unless -f after lease is obtained, |
41 | option -b makes it background sooner (when lease attempt |
42 | fails and retries start), |
43 | after backgrounding it stops logging to stderr; |
44 | logs to stderr, but option -S makes it log *also* to syslog |
45 | udhcpd - auto-backgrounds and do not log to stderr unless -f, |
46 | otherwise logs to stderr, but option -S makes it log *also* to syslog |
47 | zcip - auto-backgrounds and logs *also* to syslog unless -f |
48 | |
49 | Total: 13 applets (+1 obsolete), |
50 | 4 log to syslog by default (crond fakeidentd inetd zcip), |
51 | 5 never log to syslog (acpid httpd telnetd klogd syslogd, last two |
52 | - for obviously correct reasons), |
53 | there are no daemons which always log to syslog, |
54 | 12 auto-background if not run as inetd services (all except dnsd. |
55 | Note that there is no "standard" dnsd AFAIKS). But see below |
56 | for daemons (tcpsvd etc) which don't auto-background. |
57 | |
58 | miscutils/crond.c: logmode = LOGMODE_SYSLOG; |
59 | networking/dnsd.c: logmode = LOGMODE_SYSLOG; |
60 | networking/ftpd.c: logmode = LOGMODE_NONE; |
61 | networking/ftpd.c: logmode |= LOGMODE_SYSLOG; |
62 | networking/inetd.c: logmode = LOGMODE_SYSLOG; |
63 | networking/isrv_identd.c: logmode = LOGMODE_SYSLOG; |
64 | networking/telnetd.c: logmode = LOGMODE_SYSLOG; |
65 | networking/udhcp/dhcpc.c: logmode = LOGMODE_NONE; |
66 | networking/udhcp/dhcpc.c: logmode |= LOGMODE_SYSLOG; |
67 | networking/udhcp/dhcpc.c: logmode &= ~LOGMODE_STDIO; |
68 | networking/udhcp/dhcpd.c: logmode = LOGMODE_NONE; |
69 | networking/udhcp/dhcpd.c: logmode |= LOGMODE_SYSLOG; |
70 | networking/zcip.c: logmode |= LOGMODE_SYSLOG; |
71 | |
72 | |
73 | These daemons never auto-background and never log to syslog: |
74 | |
75 | lpd - inetd service. Has nothing to log so far, though |
76 | dhcprelay - standard behavior |
77 | inotifyd - standard behavior |
78 | runsv - standard behavior |
79 | runsvdir - standard behavior |
80 | svlogd - standard behavior |
81 | tcpsvd, udpsvd - standard behavior |
82 | tftpd - standard behavior |
83 | |
84 | |
85 | Non-daemons (seems to be use syslog for a good reason): |
86 | |
87 | networking/nameif.c: logmode |= LOGMODE_SYSLOG; |
88 | loginutils/chpasswd.c: logmode = LOGMODE_BOTH; |
89 | loginutils/chpasswd.c: logmode = LOGMODE_STDIO; |
90 | loginutils/getty.c: logmode = LOGMODE_BOTH; |
91 | loginutils/getty.c: logmode = LOGMODE_NONE; |
92 | loginutils/passwd.c: logmode = LOGMODE_STDIO; |
93 | loginutils/passwd.c: logmode = LOGMODE_BOTH; |
94 | loginutils/sulogin.c: logmode = LOGMODE_SYSLOG; (used if stdio isn't a tty) |
95 | loginutils/sulogin.c: logmode = LOGMODE_BOTH; |
96 | util-linux/mount.c: logmode = LOGMODE_SYSLOG; (used in a backgrounded NFS mount helper) |