aboutsummaryrefslogtreecommitdiff
path: root/sysklogd/syslogd.c
AgeCommit message (Collapse)Author
2015-10-18sysklogd/*: convert to new-style "one file" appletsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-13Removes stray empty line from codeManinder Singh
This patch removes stray empty line from busybox code reported by script find_stray_empty_lines Signed-off-by: Maninder Singh <maninder1.s@samsung.com> Signed-off-by: Akhilesh Kumar <akhilesh.k@samsung.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-03syslogd: make "reopen log file every second" logic work for multiple logsJoshua Judson Rosen
Move last_log_time from a single global to *each logFile_t* so that we can actually apply the logic to every log-file in multi-file configurations, rather than working only for the first file written in each 1-second interval and then leaving the others connected to possibly wrong files. Signed-off-by: Joshua Judson Rosen <jrosen@harvestai.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-02syslogd: syslogd: don't *decrement* log_file->size on write failuresJoshua Judson Rosen
Even if we fail to write to a log-file, and it's not growing, it's not *shrinking* either.... Signed-off-by: Joshua Judson Rosen <jrosen@harvestai.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-02syslogd: make "-O -" log to stdoutDenys Vlasenko
function old new delta packed_usage 29871 29908 +37 log_locally 404 440 +36 syslogd_main 1966 1956 -10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 73/-10) Total: 63 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-02syslogd: Unify unlink/truncate + unlock log-rotation logicJoshua Judson Rosen
Always unlink + reopen, rather than sometimes using ftruncate(); using a single code-path reduces the opportunity for either mistakes or duplicate code. Signed-off-by: Joshua Judson Rosen <jrosen@harvestai.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-02syslogd: remember to un-writelock log-files even when called with "-b 0"Joshua Judson Rosen
Signed-off-by: Joshua Judson Rosen <jrosen@harvestai.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-02syslogd: avoid spurious ftrunctate() calls for "-b 0"Joshua Judson Rosen
Forgetting to re-set log_file->size after truncating to zero discards log-data for the next 1 second following an oversize-induced purge, when we shouldn't necessarily throw that data away. Signed-off-by: Joshua Judson Rosen <jrosen@harvestai.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-05syslogd: use _PATH_LOG when availableCédric Cabessa
Signed-off-by: Cédric Cabessa <ccabessa@genymobile.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-15sysklogd: trim help textDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-20syslogd: do not segfault on parse error when using default config. Closes 5762Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-18syslogd: convert dummy functions to statics and get rid of IF_FEATURE_* checksPeter Korsgaard
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-14whitespace fixes. no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-06syslogd: add option to log to Linux kernel printk bufferPeter Korsgaard
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>
2012-12-19CONFIG_PID_FILE_PATH: new configuration option for pidfile pathsAnthony G. Basile
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>
2011-10-28syslogd: work around rename() not renaming hardlinks to themselvesChristian Engelmayer
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-09-16syslogd: fix missing newline problen in memory log buffer. Closes 4159Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05*: remove "Options:" string from help textsDenys Vlasenko
function old new delta packed_usage 28706 28623 -83 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-25syslogd,klogd: better help textDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-16small fixes atop syslog config patchDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-16syslogd: small fix to config patchSergey Naumov
Signed-off-by: Sergey Naumov <sknaumov@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-11move remaining help text from include/usage.src.hPere Orga
Signed-off-by: Pere Orga <gotrunks@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-10syslogd: optional support for /etc/syslog.confSergey Naumov
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-01-25add ENABLE_FEATURE_SYSTEMD and use it in syslogdDavide Cavalca
Signed-off-by: Davide Cavalca <davide@geexbox.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16*: make GNU licensing statement forms more regularDenys Vlasenko
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-03syslogd: close/re-resolve/reopen remote sockets on some sendto() errorsDaniel Dickinson
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-03-31syslogd: make maximum message length configurableJanne Kiviluoto
Signed-off-by: Janne Kiviluoto <janne.kiviluoto@bluegiga.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-28syslog: allow multiple -R optionsThomas Geulig
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-01-29syslog: remove stray umask(0)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-23*: more portability fixes by Dan FandrichDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-04-22syslogd: added comment, no code changesDenis Vlasenko
2009-04-21*: mass renaming of USE_XXXX to IF_XXXXDenis Vlasenko
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially badly named. It was not skipping anything!
2009-03-02syslogd: create logfile with 0666, not 0600.Denis Vlasenko
2008-12-09syslogd: comment out file locking;Denis Vlasenko
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-10-29whitespace fixes, no code changesDenis Vlasenko
2008-07-05*: rename ATTRIBUTE_XXX to just XXX.Denis Vlasenko
2008-06-11logger: "clean up" a dirty hack a bitDenis Vlasenko
2008-05-24syslogd: do not error out on missing files to rotate. closes bug 3404.Denis Vlasenko
2008-05-15more of -Wall fixes from Cristian Ionescu-Idbohrn.Denis Vlasenko
Some are fixing real bugs. function old new delta syslogd_main 938 958 +20 get_signum 136 143 +7 obj_load 777 782 +5 recv_from_to 210 214 +4 get_next_block 1795 1799 +4 display_topmem_process_list 1117 1121 +4 logread_main 484 487 +3 buffer_fill_and_print 73 76 +3 kill_main 687 689 +2 ll_remember_index 240 241 +1 do_stats 452 453 +1 if_readconf 166 165 -1 display_process_list 1192 1191 -1 run_applet_and_exit 507 505 -2 print_signames 33 31 -2 parse_one_line 1092 1090 -2 find_out_spec 57 55 -2 add_ksymoops_symbols 421 419 -2 ash_main 1407 1402 -5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 11/8 up/down: 54/-17) Total: 37 bytes
2008-03-17*: add -Wunused-parameter; fix resulting breakageDenis Vlasenko
function old new delta procps_scan 1265 1298 +33 aliascmd 278 283 +5 parse_file_cmd 116 120 +4 dname_enc 373 377 +4 setcmd 90 93 +3 execcmd 57 60 +3 count_lines 72 74 +2 process_command_subs 340 339 -1 test_main 409 407 -2 mknod_main 179 177 -2 handle_incoming_and_exit 2653 2651 -2 argstr 1312 1310 -2 shiftcmd 131 128 -3 exitcmd 46 43 -3 dotcmd 297 294 -3 breakcmd 86 83 -3 evalpipe 353 349 -4 evalcommand 1180 1176 -4 evalcmd 109 105 -4 send_tree 374 369 -5 mkfifo_main 82 77 -5 evalsubshell 152 147 -5 typecmd 75 69 -6 letcmd 61 55 -6 add_cmd 1190 1183 -7 main 891 883 -8 ash_main 1415 1407 -8 parse_stream 1377 1367 -10 alloc_procps_scan 55 - -55 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 7/21 up/down: 54/-148) Total: -94 bytes text data bss dec hex filename 797195 658 7428 805281 c49a1 busybox_old 797101 658 7428 805187 c4943 busybox_unstripped
2008-02-27*: add optimization barrier to all "G trick" locationsDenis Vlasenko
2008-02-26syslogd: optional support for dropping dups. closes bug 436.Denis Vlasenko
2008-02-25*: intrduce and use safe_gethostname. By Tito <farmatito AT tiscali.it>Denis Vlasenko
safe_gethostname - 48 +48 glob3 35 37 +2 timestamp_and_log 314 315 +1 udhcp_send_kernel_packet 234 231 -3 scan_tree 275 271 -4 passwd_main 1074 1070 -4 print_login_prompt 68 58 -10 obscure 392 377 -15 syslogd_main 882 866 -16 print_login_issue 516 478 -38 hostname_main 278 223 -55 parse_and_put_prompt 825 756 -69 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/9 up/down: 51/-214) Total: -163 bytes text data bss dec hex filename 798791 728 7484 807003 c505b busybox_old 798631 728 7484 806843 c4fbb busybox_unstripped
2008-02-24less,klogd,syslogd,nc,tcpudp: exit on signal by killing itself, not exit(1)Denis Vlasenko
*: minor shrink
2008-02-23syslogd: small shrinkDenis Vlasenko
2008-02-20udhcp: make paths configurableDenis Vlasenko
syslogd: trivial build fix
2008-02-19syslogd: tighten up hostname handling.Denis Vlasenko
2008-02-17libbb: introduce and use xrename and rename_or_warn.Denis Vlasenko
2008-02-16libbb: introduce bb_signals and bb_signals_recursive,Denis Vlasenko
which sets same handler for many signals. sig_catch is nuked (bb_signals_recursive is more descriptive name). *: use them as appropriate. function old new delta bb_signals_recursive - 95 +95 bb_signals - 52 +52 run_command 258 273 +15 svlogd_main 1368 1377 +9 runsv_main 1746 1752 +6 runsvdir_main 1643 1646 +3 UNSPEC_print 64 66 +2 time_main 1128 1127 -1 ... resize_main 246 210 -36 sig_catch 63 - -63 set_fatal_sighandler 85 14 -71 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 5/24 up/down: 182/-548) Total: -366 bytes
2008-02-13syslogd: send '\n'-terminated messages over the network.Denis Vlasenko
fully closes bug 1574. +8 bytes.