Commit Graph

338 Commits

Author SHA1 Message Date
Cédric Cabessa
adc30b4cf9 syslogd: use _PATH_LOG when available
Signed-off-by: Cédric Cabessa <ccabessa@genymobile.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-05 02:09:16 +02:00
Denys Vlasenko
2641426187 logread: intercept all fatal signals, not just SIGINT
function                                             old     new   delta
interrupted                                           27      20      -7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-28 23:17:00 +02:00
Denys Vlasenko
257a77568a sysklogd: trim help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-15 01:50:35 +01:00
Denys Vlasenko
81fa999540 syslogd: do not segfault on parse error when using default config. Closes 5762
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-20 16:05:41 +01:00
Peter Korsgaard
9980707efc syslogd: convert dummy functions to statics and get rid of IF_FEATURE_* checks
As suggested by Mike. No bloat-o-meter difference, but a bit nicer to look at.
We cannot convert the call to log_to_shmem() as it checks for G.shbuf outside
the function, and G.shbuf is only available when IPC support is enabled.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-18 19:46:47 +01:00
Denys Vlasenko
6967578728 whitespace fixes. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14 01:34:48 +01:00
Peter Korsgaard
cd776cf967 syslogd: add option to log to Linux kernel printk buffer
Why invent our own shared memory circular buffer when the kernel has a
perfectly fine one already?

This can be used as a smaller/simpler alternative to the syslogd IPC support
(as IPC shmem/klogd/logread aren't needed), while also allowing centralised
logging of everything (kernel messages, userspace bootup and syslog)
when used together with ttyprintk.

Notice that kernel 3.5+ is needed to store syslog facility in printk buffer,
otherwise only the priority is stored.

bloat-o-meter compared to IPC+klogd+logread:
function                                             old     new   delta
get_linux_version_code                                 -      84     +84
lbb_prepare                                           25      90     +65
applet_nameofs                                         6       -      -6
static.stdout@@GLIBC_2                                 8       -      -8
applet_names                                          23       9     -14
bb_msg_standard_output                                16       -     -16
init_sem                                              18       -     -18
xatoull_range                                         19       -     -19
overlapping_strcpy                                    21       -     -21
init_data                                             56      32     -24
applet_main                                           24       -     -24
main                                                 124      99     -25
full_write2_str                                       26       -     -26
error_exit                                            26       -     -26
bb_basename                                           30       -     -30
sem_up                                                32       -     -32
interrupted                                           35       -     -35
fflush_stdout_and_exit                                38       -     -38
bb_banner                                             46       -     -46
find_applet_by_name                                   59       -     -59
bb_signals_recursive_norestart                        90       -     -90
run_applet_no_and_exit                               104       -    -104
timestamp_and_log                                    651     523    -128
syslogd_main                                         798     581    -217
xstrtoull_range_sfx                                  267       -    -267
run_applet_and_exit                                  432       -    -432
klogd_main                                           490       -    -490
logread_main                                         508       -    -508
.rodata                                             1870     937    -933
bb_common_bufsiz1                                   8193       -   -8193
------------------------------------------------------------------------------
(add/remove: 2/26 grow/shrink: 1/6 up/down: 149/-11829)    Total: -11680 bytes

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-01-06 13:30:50 -05:00
Peter Korsgaard
d189b598b4 klogd: handle multi-char log levels
Since Linux 3.5 (7ff9554bb5: printk: convert byte-buffer to variable-length
record buffer), klog buffer can now contain log lines with multi-char
loglevel indicators (<[0-9]+>) - So use strtoul to parse it.

function                                             old     new   delta
klogd_main                                           490     525     +35
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 35/0)               Total: 35 bytes

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-01-05 21:03:19 -05:00
Anthony G. Basile
12677acf0a CONFIG_PID_FILE_PATH: new configuration option for pidfile paths
We set a default path for the directory where pidfiles are create
when FEATURE_PIDFILE is selected.  The default has no effect on
applets which must specify a pidfile path on the command line to
run, and it can be overridden by applets which optionally allow
the user to specify the pidfile path.

We also add pidfile write/remove support for klogd, ntpd and watchdog.
For syslogd, we add a missing remove_pidfile() for better cleanup
on daemon exit.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-12-19 15:53:33 -05:00
Christian Engelmayer
8de2e42201 syslogd: work around rename() not renaming hardlinks to themselves
Function log_locally() within the syslogd can potentially lock up when
restarting the daemon after a power loss in case the unplanned shutdown hit the
rename operation during logfile rotation.

While POSIX requires the rename operation to be atomic, many file systems such
as JFFS2 implement the rename operation in 2 steps by linking the new name
followed by unlinking the original name. In case of a power loss during the
rename the system can end up with /var/log/messages and /var/log/messages.0
being 2 hard links to the same file.

When the syslog daemon restarts in such a situation it will rediscover the need
to rotate the log files, however, POSIX also requires that rename does nothing
and reports success in case oldpath and newpath are existing hard links to the
same file. Looping through reopen: by (O_CREAT | O_APPEND), the daemon
eternally reopens the same file without succeeding to rotate.

Signed-off-by: Christian Engelmayer <christian.engelmayer@frequentis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-28 18:12:42 +02:00
Denys Vlasenko
514cbfc593 syslogd: fix missing newline problen in memory log buffer. Closes 4159
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-16 13:28:52 +02:00
Denys Vlasenko
66426760be *: remove "Options:" string from help texts
function                                             old     new   delta
packed_usage                                       28706   28623     -83

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05 03:58:28 +02:00
Denys Vlasenko
aeab42e3f4 syslogd,klogd: better help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-25 11:58:56 +02:00
Denys Vlasenko
0288b27ad8 small fixes atop syslog config patch
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-16 20:15:14 +02:00
Sergey Naumov
e9c8bed4d3 syslogd: small fix to config patch
Signed-off-by: Sergey Naumov <sknaumov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-16 19:36:15 +02:00
Pere Orga
5bc8c005a8 move remaining help text from include/usage.src.h
Signed-off-by: Pere Orga <gotrunks@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-11 03:29:49 +02:00
Sergey Naumov
73ef15cf38 syslogd: optional support for /etc/syslog.conf
function                                             old     new   delta
syslogd_main                                        1241    1870    +629
timestamp_and_log                                    301     540    +239
find_by_name                                           -      37     +37
find_by_val                                            -      22     +22
init_data                                             64      68      +4
log_locally                                          603     413    -190
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 3/1 up/down: 931/-190)          Total: 741 bytes

Signed-off-by: Sergey Naumov <sknaumov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-10 07:34:27 +02:00
Denys Vlasenko
8b6b472f4e klogd: fix the problem of delayed handling of ^C and SIGTERM
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-07 10:57:26 +01:00
Denys Vlasenko
e3b1a1fd28 Replace "depends on PLATFORM_LINUX" with "select PLATFORM_LINUX"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-26 22:24:08 +01:00
Davide Cavalca
9b3b9790b3 add ENABLE_FEATURE_SYSTEMD and use it in syslogd
Signed-off-by: Davide Cavalca <davide@geexbox.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-25 02:26:03 +01:00
Denys Vlasenko
e4dcba1c10 *: whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-28 18:57:19 +02:00
Denys Vlasenko
0016bcee37 klogd: do not log partial lines
function                                             old     new   delta
overlapping_strcpy                                    15      18      +3
klogd_main                                           438     436      -2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-19 23:07:49 +02:00
Denys Vlasenko
0ef64bdb40 *: make GNU licensing statement forms more regular
This change retains "or later" state! No licensing _changes_ here,
only form is adjusted (article, space between "GPL" and "v2" and so on).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 20:14:46 +02:00
Daniel Dickinson
e74d79866c syslogd: close/re-resolve/reopen remote sockets on some sendto() errors
function                                             old     new   delta
syslogd_main                                        1201    1262     +61

Signed-off-by: Daniel Dickinson <cshore@csolve.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-03 04:26:20 +02:00
Jeremie Koenig
63c2e7ecc0 klogd: make it work on non-linux systems
The klogctl() interface allows changing the console loglevel, but is
Linux-specific. The more portable method of reading from _PATH_KLOG is
added as an alternative.

Adapted from the Debian kFreeBSD patch at:
http://svn.debian.org/viewsvn/d-i/people/slackydeb/kfreebsd/busybox/1.14/debian/klogd.diff

Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-01 03:01:44 +02:00
Denys Vlasenko
ba2dcccd79 *: trailing empty lines removed
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-26 01:49:12 +02:00
Jeremie Koenig
1d7266d3b5 mark Linux-specific configuration options
PLATFORM_LINUX is used as a dependency for applets or features
which require Linux-specific interfaces.

Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-19 00:44:56 +02:00
Denys Vlasenko
d70e0e995e *: add INSERTs to *.src files where appropriate
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-08 12:15:11 +02:00
Denys Vlasenko
2f32bf8be6 remove defconfig. Now "make defconfig" simply uses defaults from Config.in
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-06 04:14:28 +02:00
Denys Vlasenko
da929a95aa mass renaming Kbuild -> Kbuild.src, Config.in -> Config.src
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-04 20:10:51 +02:00
Denys Vlasenko
345e093c29 fix Config.in tab usage
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-31 16:03:56 +02:00
Janne Kiviluoto
c897dfe011 syslogd: make maximum message length configurable
Signed-off-by: Janne Kiviluoto <janne.kiviluoto@bluegiga.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-31 15:58:58 +02:00
Thomas Geulig
d2f7779671 syslog: allow multiple -R options
function                                             old     new   delta
syslogd_main                                        1082    1177     +95
init_data                                             72      64      -8

Signed-off-by: Thomas Geulig <geulig@nentec.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-28 13:01:59 +01:00
Denys Vlasenko
98a4c7cf3d *: suppress ~60% of "aliased warnings" on gcc-4.4.1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-04 15:00:15 +01:00
Denys Vlasenko
a42524251e syslog: remove stray umask(0)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-29 16:44:48 +01:00
Denys Vlasenko
2ec91aead5 *: remove some uses of argc
function                                             old     new   delta
whoami_main                                           34      37      +3
logname_main                                          60      63      +3
hostid_main                                           35      38      +3
ttysize_main                                         136     135      -1
nmeter_main                                          673     672      -1
logger_main                                          387     386      -1
uuencode_main                                        330     328      -2
ifupdown_main                                       2125    2123      -2
mesg_main                                            158     155      -3
free_main                                            333     330      -3
cal_main                                             902     899      -3
acpid_main                                           443     440      -3
ar_main                                              196     189      -7
find_main                                            476     467      -9
ifconfig_main                                       1235    1221     -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/12 up/down: 9/-49)            Total: -40 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-04 14:15:38 +01:00
Denys Vlasenko
8131eea3dc *: introduce and use ffulsh_all()
function                                             old     new   delta
buffer_fill_and_print                                179     196     +17
fflush_all                                             -       9      +9
spawn                                                 87      92      +5
rtcwake_main                                         455     453      -2
...
alarm_intr                                            93      84      -9
readcmd                                             1072    1062     -10
bb_ask                                               345     333     -12
more_main                                            845     832     -13
flush_stdout_stderr                                   42      23     -19
xfflush_stdout                                        27       -     -27
flush_stderr                                          30       -     -30
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 2/50 up/down: 31/-397)         Total: -366 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-02 14:19:51 +01:00
Denys Vlasenko
606291beab *: more portability fixes by Dan Fandrich
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-23 23:15:43 +02:00
Denis Vlasenko
574c316e5a syslogd: added comment, no code changes 2009-04-22 02:53:02 +00:00
Denis Vlasenko
5e34ff29bc *: mass renaming of USE_XXXX to IF_XXXX
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially
badly named. It was not skipping anything!
2009-04-21 11:09:40 +00:00
Denis Vlasenko
d9415d6335 syslogd: create logfile with 0666, not 0600. 2009-03-02 14:26:28 +00:00
Denis Vlasenko
0d94820adf syslogd: comment out file locking;
make signal handling syncronous (old was racy)

function                                             old     new   delta
syslogd_main                                         963    1090    +127
quit_signal                                           96       -     -96
log_locally                                          743     595    -148
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 127/-244)         Total: -117 bytes
2008-12-09 22:53:31 +00:00
Denis Vlasenko
0c68a874e7 libbb: password/group function helpers rewritten by Tito:
function                                             old     new   delta
xgetpwuid                                              -      27     +27
uid2uname_utoa                                         -      22     +22
gid2group_utoa                                         -      22     +22
uid2uname                                              -      18     +18
gid2group                                              -      18     +18
buffer_fill_and_print                                179     196     +17
print_user                                            12      24     +12
print_group                                           12      24     +12
get_cached                                            89      99     +10
...
print_common                                         134     120     -14
vlock_main                                           415     396     -19
logger_main                                          410     387     -23
crontab_main                                         642     609     -33
bb_getpwuid                                           42       -     -42
bb_getgrgid                                           42       -     -42
bb_getug                                              80       -     -80
------------------------------------------------------------------------------
(add/remove: 6/3 grow/shrink: 9/11 up/down: 187/-296)        Total: -109 bytes
2008-12-02 22:56:59 +00:00
Denis Vlasenko
58a88916b9 klogd: fix small buglet in previous commit 2008-11-19 09:35:00 +00:00
Denis Vlasenko
2e7dc5d37b klogctl: fix a problem where we don't terminate read data with '\0'
and then misinterpret it. Code shrink while at it.

function                                             old     new   delta
klogd_main                                           404     362     -42
2008-11-19 07:59:49 +00:00
Denis Vlasenko
9504e444b8 whitespace fixes, no code changes 2008-10-29 01:19:15 +00:00
Denis Vlasenko
93d0776a96 watchdog: WDIOC_SETTIMEOUT accepts seconds, not milliseconds
klogd: handle many lines at once, by Steve Bennett (steveb AT workware.net.au)
2008-10-04 16:40:17 +00:00
Bernhard Reutner-Fischer
3e8669f359 - wrap overlong lines (Cristian Ionescu-Idbohrn)
- s/\.  /. /g;# (me)
2008-07-22 18:27:53 +00:00
Denis Vlasenko
a60f84ebf0 *: rename ATTRIBUTE_XXX to just XXX. 2008-07-05 09:18:54 +00:00
Denis Vlasenko
7049ff8696 whitespace fixes. no code changes 2008-06-25 09:53:17 +00:00