aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2015-10-18 18:42:03 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2015-10-18 22:40:09 +0200
commitd34f300db6d7a726759f4d820a61f19eacf11288 (patch)
tree3e722dad3550a08dfd5f618c8dd5fff50808674c
parent2735bc00e35c5fd8eec6d656f4d8a17ee2630c2a (diff)
downloadbusybox-w32-d34f300db6d7a726759f4d820a61f19eacf11288.tar.gz
busybox-w32-d34f300db6d7a726759f4d820a61f19eacf11288.tar.bz2
busybox-w32-d34f300db6d7a726759f4d820a61f19eacf11288.zip
sysklogd/*: convert to new-style "one file" applets
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--include/applets.src.h4
-rw-r--r--sysklogd/Config.src159
-rw-r--r--sysklogd/Kbuild.src4
-rw-r--r--sysklogd/klogd.c33
-rw-r--r--sysklogd/logger.c13
-rw-r--r--sysklogd/logread.c25
-rw-r--r--sysklogd/syslogd.c101
7 files changed, 172 insertions, 167 deletions
diff --git a/include/applets.src.h b/include/applets.src.h
index dac83e7fb..c1b8017d4 100644
--- a/include/applets.src.h
+++ b/include/applets.src.h
@@ -201,7 +201,6 @@ IF_KBD_MODE(APPLET(kbd_mode, BB_DIR_BIN, BB_SUID_DROP))
201IF_KILL(APPLET(kill, BB_DIR_BIN, BB_SUID_DROP)) 201IF_KILL(APPLET(kill, BB_DIR_BIN, BB_SUID_DROP))
202IF_KILLALL(APPLET_ODDNAME(killall, kill, BB_DIR_USR_BIN, BB_SUID_DROP, killall)) 202IF_KILLALL(APPLET_ODDNAME(killall, kill, BB_DIR_USR_BIN, BB_SUID_DROP, killall))
203IF_KILLALL5(APPLET_ODDNAME(killall5, kill, BB_DIR_USR_SBIN, BB_SUID_DROP, killall5)) 203IF_KILLALL5(APPLET_ODDNAME(killall5, kill, BB_DIR_USR_SBIN, BB_SUID_DROP, killall5))
204IF_KLOGD(APPLET(klogd, BB_DIR_SBIN, BB_SUID_DROP))
205IF_LAST(APPLET(last, BB_DIR_USR_BIN, BB_SUID_DROP)) 204IF_LAST(APPLET(last, BB_DIR_USR_BIN, BB_SUID_DROP))
206//IF_LENGTH(APPLET_NOFORK(length, length, BB_DIR_USR_BIN, BB_SUID_DROP, length)) 205//IF_LENGTH(APPLET_NOFORK(length, length, BB_DIR_USR_BIN, BB_SUID_DROP, length))
207IF_LESS(APPLET(less, BB_DIR_USR_BIN, BB_SUID_DROP)) 206IF_LESS(APPLET(less, BB_DIR_USR_BIN, BB_SUID_DROP))
@@ -211,11 +210,9 @@ IF_LN(APPLET_NOEXEC(ln, ln, BB_DIR_BIN, BB_SUID_DROP, ln))
211IF_LOAD_POLICY(APPLET(load_policy, BB_DIR_USR_SBIN, BB_SUID_DROP)) 210IF_LOAD_POLICY(APPLET(load_policy, BB_DIR_USR_SBIN, BB_SUID_DROP))
212IF_LOADFONT(APPLET(loadfont, BB_DIR_USR_SBIN, BB_SUID_DROP)) 211IF_LOADFONT(APPLET(loadfont, BB_DIR_USR_SBIN, BB_SUID_DROP))
213IF_LOADKMAP(APPLET(loadkmap, BB_DIR_SBIN, BB_SUID_DROP)) 212IF_LOADKMAP(APPLET(loadkmap, BB_DIR_SBIN, BB_SUID_DROP))
214IF_LOGGER(APPLET(logger, BB_DIR_USR_BIN, BB_SUID_DROP))
215/* Needs to be run by root or be suid root - needs to change uid and gid: */ 213/* Needs to be run by root or be suid root - needs to change uid and gid: */
216IF_LOGIN(APPLET(login, BB_DIR_BIN, BB_SUID_REQUIRE)) 214IF_LOGIN(APPLET(login, BB_DIR_BIN, BB_SUID_REQUIRE))
217IF_LOGNAME(APPLET_NOFORK(logname, logname, BB_DIR_USR_BIN, BB_SUID_DROP, logname)) 215IF_LOGNAME(APPLET_NOFORK(logname, logname, BB_DIR_USR_BIN, BB_SUID_DROP, logname))
218IF_LOGREAD(APPLET(logread, BB_DIR_SBIN, BB_SUID_DROP))
219IF_LOSETUP(APPLET(losetup, BB_DIR_SBIN, BB_SUID_DROP)) 216IF_LOSETUP(APPLET(losetup, BB_DIR_SBIN, BB_SUID_DROP))
220IF_LPD(APPLET(lpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) 217IF_LPD(APPLET(lpd, BB_DIR_USR_SBIN, BB_SUID_DROP))
221IF_LPQ(APPLET_ODDNAME(lpq, lpqr, BB_DIR_USR_BIN, BB_SUID_DROP, lpq)) 218IF_LPQ(APPLET_ODDNAME(lpq, lpqr, BB_DIR_USR_BIN, BB_SUID_DROP, lpq))
@@ -338,7 +335,6 @@ IF_SWAPONOFF(APPLET_ODDNAME(swapoff, swap_on_off, BB_DIR_SBIN, BB_SUID_DROP, swa
338IF_SWAPONOFF(APPLET_ODDNAME(swapon, swap_on_off, BB_DIR_SBIN, BB_SUID_DROP, swapon)) 335IF_SWAPONOFF(APPLET_ODDNAME(swapon, swap_on_off, BB_DIR_SBIN, BB_SUID_DROP, swapon))
339IF_SWITCH_ROOT(APPLET(switch_root, BB_DIR_SBIN, BB_SUID_DROP)) 336IF_SWITCH_ROOT(APPLET(switch_root, BB_DIR_SBIN, BB_SUID_DROP))
340IF_BB_SYSCTL(APPLET(sysctl, BB_DIR_SBIN, BB_SUID_DROP)) 337IF_BB_SYSCTL(APPLET(sysctl, BB_DIR_SBIN, BB_SUID_DROP))
341IF_SYSLOGD(APPLET(syslogd, BB_DIR_SBIN, BB_SUID_DROP))
342IF_TAC(APPLET_NOEXEC(tac, tac, BB_DIR_USR_BIN, BB_SUID_DROP, tac)) 338IF_TAC(APPLET_NOEXEC(tac, tac, BB_DIR_USR_BIN, BB_SUID_DROP, tac))
343IF_TAIL(APPLET(tail, BB_DIR_USR_BIN, BB_SUID_DROP)) 339IF_TAIL(APPLET(tail, BB_DIR_USR_BIN, BB_SUID_DROP))
344/* IF_TC(APPLET(tc, BB_DIR_SBIN, BB_SUID_DROP)) */ 340/* IF_TC(APPLET(tc, BB_DIR_SBIN, BB_SUID_DROP)) */
diff --git a/sysklogd/Config.src b/sysklogd/Config.src
index fcf993054..684e7d414 100644
--- a/sysklogd/Config.src
+++ b/sysklogd/Config.src
@@ -7,163 +7,4 @@ menu "System Logging Utilities"
7 7
8INSERT 8INSERT
9 9
10config SYSLOGD
11 bool "syslogd"
12 default y
13 help
14 The syslogd utility is used to record logs of all the
15 significant events that occur on a system. Every
16 message that is logged records the date and time of the
17 event, and will generally also record the name of the
18 application that generated the message. When used in
19 conjunction with klogd, messages from the Linux kernel
20 can also be recorded. This is terribly useful,
21 especially for finding what happened when something goes
22 wrong. And something almost always will go wrong if
23 you wait long enough....
24
25config FEATURE_ROTATE_LOGFILE
26 bool "Rotate message files"
27 default y
28 depends on SYSLOGD
29 help
30 This enables syslogd to rotate the message files
31 on his own. No need to use an external rotatescript.
32
33config FEATURE_REMOTE_LOG
34 bool "Remote Log support"
35 default y
36 depends on SYSLOGD
37 help
38 When you enable this feature, the syslogd utility can
39 be used to send system log messages to another system
40 connected via a network. This allows the remote
41 machine to log all the system messages, which can be
42 terribly useful for reducing the number of serial
43 cables you use. It can also be a very good security
44 measure to prevent system logs from being tampered with
45 by an intruder.
46
47config FEATURE_SYSLOGD_DUP
48 bool "Support -D (drop dups) option"
49 default y
50 depends on SYSLOGD
51 help
52 Option -D instructs syslogd to drop consecutive messages
53 which are totally the same.
54
55config FEATURE_SYSLOGD_CFG
56 bool "Support syslog.conf"
57 default y
58 depends on SYSLOGD
59 help
60 Supports restricted syslogd config. See docs/syslog.conf.txt
61
62config FEATURE_SYSLOGD_READ_BUFFER_SIZE
63 int "Read buffer size in bytes"
64 default 256
65 range 256 20000
66 depends on SYSLOGD
67 help
68 This option sets the size of the syslog read buffer.
69 Actual memory usage increases around five times the
70 change done here.
71
72config FEATURE_IPC_SYSLOG
73 bool "Circular Buffer support"
74 default y
75 depends on SYSLOGD
76 help
77 When you enable this feature, the syslogd utility will
78 use a circular buffer to record system log messages.
79 When the buffer is filled it will continue to overwrite
80 the oldest messages. This can be very useful for
81 systems with little or no permanent storage, since
82 otherwise system logs can eventually fill up your
83 entire filesystem, which may cause your system to
84 break badly.
85
86config FEATURE_IPC_SYSLOG_BUFFER_SIZE
87 int "Circular buffer size in Kbytes (minimum 4KB)"
88 default 16
89 range 4 2147483647
90 depends on FEATURE_IPC_SYSLOG
91 help
92 This option sets the size of the circular buffer
93 used to record system log messages.
94
95config LOGREAD
96 bool "logread"
97 default y
98 depends on FEATURE_IPC_SYSLOG
99 help
100 If you enabled Circular Buffer support, you almost
101 certainly want to enable this feature as well. This
102 utility will allow you to read the messages that are
103 stored in the syslogd circular buffer.
104
105config FEATURE_LOGREAD_REDUCED_LOCKING
106 bool "Double buffering"
107 default y
108 depends on LOGREAD
109 help
110 'logread' ouput to slow serial terminals can have
111 side effects on syslog because of the semaphore.
112 This option make logread to double buffer copy
113 from circular buffer, minimizing semaphore
114 contention at some minor memory expense.
115
116config FEATURE_KMSG_SYSLOG
117 bool "Linux kernel printk buffer support"
118 default y
119 depends on SYSLOGD
120 select PLATFORM_LINUX
121 help
122 When you enable this feature, the syslogd utility will
123 write system log message to the Linux kernel's printk buffer.
124 This can be used as a smaller alternative to the syslogd IPC
125 support, as klogd and logread aren't needed.
126
127 NOTICE: Syslog facilities in log entries needs kernel 3.5+.
128
129config KLOGD
130 bool "klogd"
131 default y
132 help
133 klogd is a utility which intercepts and logs all
134 messages from the Linux kernel and sends the messages
135 out to the 'syslogd' utility so they can be logged. If
136 you wish to record the messages produced by the kernel,
137 you should enable this option.
138
139comment "klogd should not be used together with syslog to kernel printk buffer"
140 depends on KLOGD && FEATURE_KMSG_SYSLOG
141
142config FEATURE_KLOGD_KLOGCTL
143 bool "Use the klogctl() interface"
144 default y
145 depends on KLOGD
146 select PLATFORM_LINUX
147 help
148 The klogd applet supports two interfaces for reading
149 kernel messages. Linux provides the klogctl() interface
150 which allows reading messages from the kernel ring buffer
151 independently from the file system.
152
153 If you answer 'N' here, klogd will use the more portable
154 approach of reading them from /proc or a device node.
155 However, this method requires the file to be available.
156
157 If in doubt, say 'Y'.
158
159config LOGGER
160 bool "logger"
161 default y
162 select FEATURE_SYSLOG
163 help
164 The logger utility allows you to send arbitrary text
165 messages to the system log (i.e. the 'syslogd' utility) so
166 they can be logged. This is generally used to help locate
167 problems that occur within programs and scripts.
168
169endmenu 10endmenu
diff --git a/sysklogd/Kbuild.src b/sysklogd/Kbuild.src
index d386cc291..6b4fb7470 100644
--- a/sysklogd/Kbuild.src
+++ b/sysklogd/Kbuild.src
@@ -7,7 +7,3 @@
7lib-y:= 7lib-y:=
8 8
9INSERT 9INSERT
10lib-$(CONFIG_KLOGD) += klogd.o
11lib-$(CONFIG_LOGGER) += syslogd_and_logger.o
12lib-$(CONFIG_LOGREAD) += logread.o
13lib-$(CONFIG_SYSLOGD) += syslogd_and_logger.o
diff --git a/sysklogd/klogd.c b/sysklogd/klogd.c
index 432ded153..ca8b848bd 100644
--- a/sysklogd/klogd.c
+++ b/sysklogd/klogd.c
@@ -16,6 +16,39 @@
16 * 16 *
17 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 17 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
18 */ 18 */
19//config:config KLOGD
20//config: bool "klogd"
21//config: default y
22//config: help
23//config: klogd is a utility which intercepts and logs all
24//config: messages from the Linux kernel and sends the messages
25//config: out to the 'syslogd' utility so they can be logged. If
26//config: you wish to record the messages produced by the kernel,
27//config: you should enable this option.
28//config:
29//config:comment "klogd should not be used together with syslog to kernel printk buffer"
30//config: depends on KLOGD && FEATURE_KMSG_SYSLOG
31//config:
32//config:config FEATURE_KLOGD_KLOGCTL
33//config: bool "Use the klogctl() interface"
34//config: default y
35//config: depends on KLOGD
36//config: select PLATFORM_LINUX
37//config: help
38//config: The klogd applet supports two interfaces for reading
39//config: kernel messages. Linux provides the klogctl() interface
40//config: which allows reading messages from the kernel ring buffer
41//config: independently from the file system.
42//config:
43//config: If you answer 'N' here, klogd will use the more portable
44//config: approach of reading them from /proc or a device node.
45//config: However, this method requires the file to be available.
46//config:
47//config: If in doubt, say 'Y'.
48
49//applet:IF_KLOGD(APPLET(klogd, BB_DIR_SBIN, BB_SUID_DROP))
50
51//kbuild:lib-$(CONFIG_KLOGD) += klogd.o
19 52
20//usage:#define klogd_trivial_usage 53//usage:#define klogd_trivial_usage
21//usage: "[-c N] [-n]" 54//usage: "[-c N] [-n]"
diff --git a/sysklogd/logger.c b/sysklogd/logger.c
index 5a7027731..b3ca85703 100644
--- a/sysklogd/logger.c
+++ b/sysklogd/logger.c
@@ -6,6 +6,19 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config LOGGER
10//config: bool "logger"
11//config: default y
12//config: select FEATURE_SYSLOG
13//config: help
14//config: The logger utility allows you to send arbitrary text
15//config: messages to the system log (i.e. the 'syslogd' utility) so
16//config: they can be logged. This is generally used to help locate
17//config: problems that occur within programs and scripts.
18
19//applet:IF_LOGGER(APPLET(logger, BB_DIR_USR_BIN, BB_SUID_DROP))
20
21//kbuild:lib-$(CONFIG_LOGGER) += syslogd_and_logger.o
9 22
10//usage:#define logger_trivial_usage 23//usage:#define logger_trivial_usage
11//usage: "[OPTIONS] [MESSAGE]" 24//usage: "[OPTIONS] [MESSAGE]"
diff --git a/sysklogd/logread.c b/sysklogd/logread.c
index da4a4d4df..781a603b2 100644
--- a/sysklogd/logread.c
+++ b/sysklogd/logread.c
@@ -8,6 +8,31 @@
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11//config:config LOGREAD
12//config: bool "logread"
13//config: default y
14//config: depends on FEATURE_IPC_SYSLOG
15//config: help
16//config: If you enabled Circular Buffer support, you almost
17//config: certainly want to enable this feature as well. This
18//config: utility will allow you to read the messages that are
19//config: stored in the syslogd circular buffer.
20//config:
21//config:config FEATURE_LOGREAD_REDUCED_LOCKING
22//config: bool "Double buffering"
23//config: default y
24//config: depends on LOGREAD
25//config: help
26//config: 'logread' ouput to slow serial terminals can have
27//config: side effects on syslog because of the semaphore.
28//config: This option make logread to double buffer copy
29//config: from circular buffer, minimizing semaphore
30//config: contention at some minor memory expense.
31//config:
32
33//applet:IF_LOGREAD(APPLET(logread, BB_DIR_SBIN, BB_SUID_DROP))
34
35//kbuild:lib-$(CONFIG_LOGREAD) += logread.o
11 36
12//usage:#define logread_trivial_usage 37//usage:#define logread_trivial_usage
13//usage: "[-fF]" 38//usage: "[-fF]"
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 156f487e5..288b29cf7 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -12,6 +12,107 @@
12 * 12 *
13 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 13 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
14 */ 14 */
15//config:config SYSLOGD
16//config: bool "syslogd"
17//config: default y
18//config: help
19//config: The syslogd utility is used to record logs of all the
20//config: significant events that occur on a system. Every
21//config: message that is logged records the date and time of the
22//config: event, and will generally also record the name of the
23//config: application that generated the message. When used in
24//config: conjunction with klogd, messages from the Linux kernel
25//config: can also be recorded. This is terribly useful,
26//config: especially for finding what happened when something goes
27//config: wrong. And something almost always will go wrong if
28//config: you wait long enough....
29//config:
30//config:config FEATURE_ROTATE_LOGFILE
31//config: bool "Rotate message files"
32//config: default y
33//config: depends on SYSLOGD
34//config: help
35//config: This enables syslogd to rotate the message files
36//config: on his own. No need to use an external rotatescript.
37//config:
38//config:config FEATURE_REMOTE_LOG
39//config: bool "Remote Log support"
40//config: default y
41//config: depends on SYSLOGD
42//config: help
43//config: When you enable this feature, the syslogd utility can
44//config: be used to send system log messages to another system
45//config: connected via a network. This allows the remote
46//config: machine to log all the system messages, which can be
47//config: terribly useful for reducing the number of serial
48//config: cables you use. It can also be a very good security
49//config: measure to prevent system logs from being tampered with
50//config: by an intruder.
51//config:
52//config:config FEATURE_SYSLOGD_DUP
53//config: bool "Support -D (drop dups) option"
54//config: default y
55//config: depends on SYSLOGD
56//config: help
57//config: Option -D instructs syslogd to drop consecutive messages
58//config: which are totally the same.
59//config:
60//config:config FEATURE_SYSLOGD_CFG
61//config: bool "Support syslog.conf"
62//config: default y
63//config: depends on SYSLOGD
64//config: help
65//config: Supports restricted syslogd config. See docs/syslog.conf.txt
66//config:
67//config:config FEATURE_SYSLOGD_READ_BUFFER_SIZE
68//config: int "Read buffer size in bytes"
69//config: default 256
70//config: range 256 20000
71//config: depends on SYSLOGD
72//config: help
73//config: This option sets the size of the syslog read buffer.
74//config: Actual memory usage increases around five times the
75//config: change done here.
76//config:
77//config:config FEATURE_IPC_SYSLOG
78//config: bool "Circular Buffer support"
79//config: default y
80//config: depends on SYSLOGD
81//config: help
82//config: When you enable this feature, the syslogd utility will
83//config: use a circular buffer to record system log messages.
84//config: When the buffer is filled it will continue to overwrite
85//config: the oldest messages. This can be very useful for
86//config: systems with little or no permanent storage, since
87//config: otherwise system logs can eventually fill up your
88//config: entire filesystem, which may cause your system to
89//config: break badly.
90//config:
91//config:config FEATURE_IPC_SYSLOG_BUFFER_SIZE
92//config: int "Circular buffer size in Kbytes (minimum 4KB)"
93//config: default 16
94//config: range 4 2147483647
95//config: depends on FEATURE_IPC_SYSLOG
96//config: help
97//config: This option sets the size of the circular buffer
98//config: used to record system log messages.
99//config:
100//config:config FEATURE_KMSG_SYSLOG
101//config: bool "Linux kernel printk buffer support"
102//config: default y
103//config: depends on SYSLOGD
104//config: select PLATFORM_LINUX
105//config: help
106//config: When you enable this feature, the syslogd utility will
107//config: write system log message to the Linux kernel's printk buffer.
108//config: This can be used as a smaller alternative to the syslogd IPC
109//config: support, as klogd and logread aren't needed.
110//config:
111//config: NOTICE: Syslog facilities in log entries needs kernel 3.5+.
112
113//applet:IF_SYSLOGD(APPLET(syslogd, BB_DIR_SBIN, BB_SUID_DROP))
114
115//kbuild:lib-$(CONFIG_SYSLOGD) += syslogd_and_logger.o
15 116
16//usage:#define syslogd_trivial_usage 117//usage:#define syslogd_trivial_usage
17//usage: "[OPTIONS]" 118//usage: "[OPTIONS]"