From d34f300db6d7a726759f4d820a61f19eacf11288 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 18 Oct 2015 18:42:03 +0200 Subject: sysklogd/*: convert to new-style "one file" applets Signed-off-by: Denys Vlasenko --- include/applets.src.h | 4 -- sysklogd/Config.src | 159 -------------------------------------------------- sysklogd/Kbuild.src | 4 -- sysklogd/klogd.c | 33 +++++++++++ sysklogd/logger.c | 13 +++++ sysklogd/logread.c | 25 ++++++++ sysklogd/syslogd.c | 101 ++++++++++++++++++++++++++++++++ 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)) IF_KILL(APPLET(kill, BB_DIR_BIN, BB_SUID_DROP)) IF_KILLALL(APPLET_ODDNAME(killall, kill, BB_DIR_USR_BIN, BB_SUID_DROP, killall)) IF_KILLALL5(APPLET_ODDNAME(killall5, kill, BB_DIR_USR_SBIN, BB_SUID_DROP, killall5)) -IF_KLOGD(APPLET(klogd, BB_DIR_SBIN, BB_SUID_DROP)) IF_LAST(APPLET(last, BB_DIR_USR_BIN, BB_SUID_DROP)) //IF_LENGTH(APPLET_NOFORK(length, length, BB_DIR_USR_BIN, BB_SUID_DROP, length)) IF_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)) IF_LOAD_POLICY(APPLET(load_policy, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_LOADFONT(APPLET(loadfont, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_LOADKMAP(APPLET(loadkmap, BB_DIR_SBIN, BB_SUID_DROP)) -IF_LOGGER(APPLET(logger, BB_DIR_USR_BIN, BB_SUID_DROP)) /* Needs to be run by root or be suid root - needs to change uid and gid: */ IF_LOGIN(APPLET(login, BB_DIR_BIN, BB_SUID_REQUIRE)) IF_LOGNAME(APPLET_NOFORK(logname, logname, BB_DIR_USR_BIN, BB_SUID_DROP, logname)) -IF_LOGREAD(APPLET(logread, BB_DIR_SBIN, BB_SUID_DROP)) IF_LOSETUP(APPLET(losetup, BB_DIR_SBIN, BB_SUID_DROP)) IF_LPD(APPLET(lpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_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 IF_SWAPONOFF(APPLET_ODDNAME(swapon, swap_on_off, BB_DIR_SBIN, BB_SUID_DROP, swapon)) IF_SWITCH_ROOT(APPLET(switch_root, BB_DIR_SBIN, BB_SUID_DROP)) IF_BB_SYSCTL(APPLET(sysctl, BB_DIR_SBIN, BB_SUID_DROP)) -IF_SYSLOGD(APPLET(syslogd, BB_DIR_SBIN, BB_SUID_DROP)) IF_TAC(APPLET_NOEXEC(tac, tac, BB_DIR_USR_BIN, BB_SUID_DROP, tac)) IF_TAIL(APPLET(tail, BB_DIR_USR_BIN, BB_SUID_DROP)) /* 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" INSERT -config SYSLOGD - bool "syslogd" - default y - help - The syslogd utility is used to record logs of all the - significant events that occur on a system. Every - message that is logged records the date and time of the - event, and will generally also record the name of the - application that generated the message. When used in - conjunction with klogd, messages from the Linux kernel - can also be recorded. This is terribly useful, - especially for finding what happened when something goes - wrong. And something almost always will go wrong if - you wait long enough.... - -config FEATURE_ROTATE_LOGFILE - bool "Rotate message files" - default y - depends on SYSLOGD - help - This enables syslogd to rotate the message files - on his own. No need to use an external rotatescript. - -config FEATURE_REMOTE_LOG - bool "Remote Log support" - default y - depends on SYSLOGD - help - When you enable this feature, the syslogd utility can - be used to send system log messages to another system - connected via a network. This allows the remote - machine to log all the system messages, which can be - terribly useful for reducing the number of serial - cables you use. It can also be a very good security - measure to prevent system logs from being tampered with - by an intruder. - -config FEATURE_SYSLOGD_DUP - bool "Support -D (drop dups) option" - default y - depends on SYSLOGD - help - Option -D instructs syslogd to drop consecutive messages - which are totally the same. - -config FEATURE_SYSLOGD_CFG - bool "Support syslog.conf" - default y - depends on SYSLOGD - help - Supports restricted syslogd config. See docs/syslog.conf.txt - -config FEATURE_SYSLOGD_READ_BUFFER_SIZE - int "Read buffer size in bytes" - default 256 - range 256 20000 - depends on SYSLOGD - help - This option sets the size of the syslog read buffer. - Actual memory usage increases around five times the - change done here. - -config FEATURE_IPC_SYSLOG - bool "Circular Buffer support" - default y - depends on SYSLOGD - help - When you enable this feature, the syslogd utility will - use a circular buffer to record system log messages. - When the buffer is filled it will continue to overwrite - the oldest messages. This can be very useful for - systems with little or no permanent storage, since - otherwise system logs can eventually fill up your - entire filesystem, which may cause your system to - break badly. - -config FEATURE_IPC_SYSLOG_BUFFER_SIZE - int "Circular buffer size in Kbytes (minimum 4KB)" - default 16 - range 4 2147483647 - depends on FEATURE_IPC_SYSLOG - help - This option sets the size of the circular buffer - used to record system log messages. - -config LOGREAD - bool "logread" - default y - depends on FEATURE_IPC_SYSLOG - help - If you enabled Circular Buffer support, you almost - certainly want to enable this feature as well. This - utility will allow you to read the messages that are - stored in the syslogd circular buffer. - -config FEATURE_LOGREAD_REDUCED_LOCKING - bool "Double buffering" - default y - depends on LOGREAD - help - 'logread' ouput to slow serial terminals can have - side effects on syslog because of the semaphore. - This option make logread to double buffer copy - from circular buffer, minimizing semaphore - contention at some minor memory expense. - -config FEATURE_KMSG_SYSLOG - bool "Linux kernel printk buffer support" - default y - depends on SYSLOGD - select PLATFORM_LINUX - help - When you enable this feature, the syslogd utility will - write system log message to the Linux kernel's printk buffer. - This can be used as a smaller alternative to the syslogd IPC - support, as klogd and logread aren't needed. - - NOTICE: Syslog facilities in log entries needs kernel 3.5+. - -config KLOGD - bool "klogd" - default y - help - klogd is a utility which intercepts and logs all - messages from the Linux kernel and sends the messages - out to the 'syslogd' utility so they can be logged. If - you wish to record the messages produced by the kernel, - you should enable this option. - -comment "klogd should not be used together with syslog to kernel printk buffer" - depends on KLOGD && FEATURE_KMSG_SYSLOG - -config FEATURE_KLOGD_KLOGCTL - bool "Use the klogctl() interface" - default y - depends on KLOGD - select PLATFORM_LINUX - help - The klogd applet supports two interfaces for reading - kernel messages. Linux provides the klogctl() interface - which allows reading messages from the kernel ring buffer - independently from the file system. - - If you answer 'N' here, klogd will use the more portable - approach of reading them from /proc or a device node. - However, this method requires the file to be available. - - If in doubt, say 'Y'. - -config LOGGER - bool "logger" - default y - select FEATURE_SYSLOG - help - The logger utility allows you to send arbitrary text - messages to the system log (i.e. the 'syslogd' utility) so - they can be logged. This is generally used to help locate - problems that occur within programs and scripts. - endmenu 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 @@ lib-y:= INSERT -lib-$(CONFIG_KLOGD) += klogd.o -lib-$(CONFIG_LOGGER) += syslogd_and_logger.o -lib-$(CONFIG_LOGREAD) += logread.o -lib-$(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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config KLOGD +//config: bool "klogd" +//config: default y +//config: help +//config: klogd is a utility which intercepts and logs all +//config: messages from the Linux kernel and sends the messages +//config: out to the 'syslogd' utility so they can be logged. If +//config: you wish to record the messages produced by the kernel, +//config: you should enable this option. +//config: +//config:comment "klogd should not be used together with syslog to kernel printk buffer" +//config: depends on KLOGD && FEATURE_KMSG_SYSLOG +//config: +//config:config FEATURE_KLOGD_KLOGCTL +//config: bool "Use the klogctl() interface" +//config: default y +//config: depends on KLOGD +//config: select PLATFORM_LINUX +//config: help +//config: The klogd applet supports two interfaces for reading +//config: kernel messages. Linux provides the klogctl() interface +//config: which allows reading messages from the kernel ring buffer +//config: independently from the file system. +//config: +//config: If you answer 'N' here, klogd will use the more portable +//config: approach of reading them from /proc or a device node. +//config: However, this method requires the file to be available. +//config: +//config: If in doubt, say 'Y'. + +//applet:IF_KLOGD(APPLET(klogd, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_KLOGD) += klogd.o //usage:#define klogd_trivial_usage //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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config LOGGER +//config: bool "logger" +//config: default y +//config: select FEATURE_SYSLOG +//config: help +//config: The logger utility allows you to send arbitrary text +//config: messages to the system log (i.e. the 'syslogd' utility) so +//config: they can be logged. This is generally used to help locate +//config: problems that occur within programs and scripts. + +//applet:IF_LOGGER(APPLET(logger, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_LOGGER) += syslogd_and_logger.o //usage:#define logger_trivial_usage //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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config LOGREAD +//config: bool "logread" +//config: default y +//config: depends on FEATURE_IPC_SYSLOG +//config: help +//config: If you enabled Circular Buffer support, you almost +//config: certainly want to enable this feature as well. This +//config: utility will allow you to read the messages that are +//config: stored in the syslogd circular buffer. +//config: +//config:config FEATURE_LOGREAD_REDUCED_LOCKING +//config: bool "Double buffering" +//config: default y +//config: depends on LOGREAD +//config: help +//config: 'logread' ouput to slow serial terminals can have +//config: side effects on syslog because of the semaphore. +//config: This option make logread to double buffer copy +//config: from circular buffer, minimizing semaphore +//config: contention at some minor memory expense. +//config: + +//applet:IF_LOGREAD(APPLET(logread, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_LOGREAD) += logread.o //usage:#define logread_trivial_usage //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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config SYSLOGD +//config: bool "syslogd" +//config: default y +//config: help +//config: The syslogd utility is used to record logs of all the +//config: significant events that occur on a system. Every +//config: message that is logged records the date and time of the +//config: event, and will generally also record the name of the +//config: application that generated the message. When used in +//config: conjunction with klogd, messages from the Linux kernel +//config: can also be recorded. This is terribly useful, +//config: especially for finding what happened when something goes +//config: wrong. And something almost always will go wrong if +//config: you wait long enough.... +//config: +//config:config FEATURE_ROTATE_LOGFILE +//config: bool "Rotate message files" +//config: default y +//config: depends on SYSLOGD +//config: help +//config: This enables syslogd to rotate the message files +//config: on his own. No need to use an external rotatescript. +//config: +//config:config FEATURE_REMOTE_LOG +//config: bool "Remote Log support" +//config: default y +//config: depends on SYSLOGD +//config: help +//config: When you enable this feature, the syslogd utility can +//config: be used to send system log messages to another system +//config: connected via a network. This allows the remote +//config: machine to log all the system messages, which can be +//config: terribly useful for reducing the number of serial +//config: cables you use. It can also be a very good security +//config: measure to prevent system logs from being tampered with +//config: by an intruder. +//config: +//config:config FEATURE_SYSLOGD_DUP +//config: bool "Support -D (drop dups) option" +//config: default y +//config: depends on SYSLOGD +//config: help +//config: Option -D instructs syslogd to drop consecutive messages +//config: which are totally the same. +//config: +//config:config FEATURE_SYSLOGD_CFG +//config: bool "Support syslog.conf" +//config: default y +//config: depends on SYSLOGD +//config: help +//config: Supports restricted syslogd config. See docs/syslog.conf.txt +//config: +//config:config FEATURE_SYSLOGD_READ_BUFFER_SIZE +//config: int "Read buffer size in bytes" +//config: default 256 +//config: range 256 20000 +//config: depends on SYSLOGD +//config: help +//config: This option sets the size of the syslog read buffer. +//config: Actual memory usage increases around five times the +//config: change done here. +//config: +//config:config FEATURE_IPC_SYSLOG +//config: bool "Circular Buffer support" +//config: default y +//config: depends on SYSLOGD +//config: help +//config: When you enable this feature, the syslogd utility will +//config: use a circular buffer to record system log messages. +//config: When the buffer is filled it will continue to overwrite +//config: the oldest messages. This can be very useful for +//config: systems with little or no permanent storage, since +//config: otherwise system logs can eventually fill up your +//config: entire filesystem, which may cause your system to +//config: break badly. +//config: +//config:config FEATURE_IPC_SYSLOG_BUFFER_SIZE +//config: int "Circular buffer size in Kbytes (minimum 4KB)" +//config: default 16 +//config: range 4 2147483647 +//config: depends on FEATURE_IPC_SYSLOG +//config: help +//config: This option sets the size of the circular buffer +//config: used to record system log messages. +//config: +//config:config FEATURE_KMSG_SYSLOG +//config: bool "Linux kernel printk buffer support" +//config: default y +//config: depends on SYSLOGD +//config: select PLATFORM_LINUX +//config: help +//config: When you enable this feature, the syslogd utility will +//config: write system log message to the Linux kernel's printk buffer. +//config: This can be used as a smaller alternative to the syslogd IPC +//config: support, as klogd and logread aren't needed. +//config: +//config: NOTICE: Syslog facilities in log entries needs kernel 3.5+. + +//applet:IF_SYSLOGD(APPLET(syslogd, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_SYSLOGD) += syslogd_and_logger.o //usage:#define syslogd_trivial_usage //usage: "[OPTIONS]" -- cgit v1.2.3