Age | Commit message (Collapse) | Author |
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
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>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
packed_usage 28706 28623 -83
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Sergey Naumov <sknaumov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Pere Orga <gotrunks@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
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>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Davide Cavalca <davide@geexbox.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
overlapping_strcpy 15 18 +3
klogd_main 438 436 -2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
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>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Janne Kiviluoto <janne.kiviluoto@bluegiga.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
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>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
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>
|
|
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>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
|
|
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially
badly named. It was not skipping anything!
|
|
|
|
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
|
|
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
|
|
|
|
and then misinterpret it. Code shrink while at it.
function old new delta
klogd_main 404 362 -42
|
|
|
|
klogd: handle many lines at once, by Steve Bennett (steveb AT workware.net.au)
|
|
- s/\. /. /g;# (me)
|
|
|
|
|
|
|
|
klogd: by using a register instead of global variable, shrink code a bit
function old new delta
klogd_main 372 362 -10
packed_usage 24504 24486 -18
text data bss dec hex filename
808464 642 7180 816286 c749e busybox_old
808422 642 7180 816244 c7474 busybox_unstripped
|