summaryrefslogtreecommitdiff
path: root/sysklogd/klogd.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove "select PLATFORM_LINUX"Denys Vlasenko2022-11-291-1/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Fix non-Linux buildsSamuel Thibault2022-11-291-0/+1
| | | | | | | | | | | Various tools are Linuxish and should thus only attempted to build on Linux only. Some features are also Linux-only. Also, libresolv is used on all GNU platforms, notably GNU/Hurd and GNU/kfreeBSD. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* runsv: robustify signal handling - SIGTERM to child between vfork and exec ↵Denys Vlasenko2021-06-051-1/+1
| | | | | | | | | | | | | | | | | could mess things up While at it, rename bb_signals_recursive_norestart() to bb_signals_norestart(): "recursive" was implying we are setting SA_NODEFER allowing signal handler to be entered recursively, but we do not do that. function old new delta bb_signals_norestart - 70 +70 startservice 380 394 +14 bb_signals_recursive_norestart 70 - -70 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 1/0 up/down: 84/-70) Total: 14 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Fix klogd applet compilation on the FreeBSDAlex Samorukov2021-01-041-1/+1
| | | | | | | FreeBSD also using /dev/klog, see syslogd(8) Signed-off-by: Alex Samorukov <samm@os2.kiev.ua> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* build system: drop PLATFORM_LINUXRon Yorston2020-08-131-1/+0
| | | | | | | | | | | | | | | PLATFORM_LINUX is a hidden configuration option which is disabled by default and enabled at over a hundred locations for features that are deemed to be Linux specific. The only effect of PLATFORM_LINUX is to control compilation of libbb/match_fstype.c. This file is only needed by mount and umount. Remove all references to PLATFORM_LINUX and compile match_fstype.c if mount or umount is enabled. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: reduce the overhead of single parameter bb_error_msg() callsJames Byrne2019-07-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Back in 2007, commit 0c97c9d43707 ("'simple' error message functions by Loic Grenie") introduced bb_simple_perror_msg() to allow for a lower overhead call to bb_perror_msg() when only a string was being printed with no parameters. This saves space for some CPU architectures because it avoids the overhead of a call to a variadic function. However there has never been a simple version of bb_error_msg(), and since 2007 many new calls to bb_perror_msg() have been added that only take a single parameter and so could have been using bb_simple_perror_message(). This changeset introduces 'simple' versions of bb_info_msg(), bb_error_msg(), bb_error_msg_and_die(), bb_herror_msg() and bb_herror_msg_and_die(), and replaces all calls that only take a single parameter, or use something like ("%s", arg), with calls to the corresponding 'simple' version. Since it is likely that single parameter calls to the variadic functions may be accidentally reintroduced in the future a new debugging config option WARN_SIMPLE_MSG has been introduced. This uses some macro magic which will cause any such calls to generate a warning, but this is turned off by default to avoid use of the unpleasant macros in normal circumstances. This is a large changeset due to the number of calls that have been replaced. The only files that contain changes other than simple substitution of function calls are libbb.h, libbb/herror_msg.c, libbb/verror_msg.c and libbb/xfuncs_printf.c. In miscutils/devfsd.c, networking/udhcp/common.h and util-linux/mdev.c additonal macros have been added for logging so that single parameter and multiple parameter logging variants exist. The amount of space saved varies considerably by architecture, and was found to be as follows (for 'defconfig' using GCC 7.4): Arm: -92 bytes MIPS: -52 bytes PPC: -1836 bytes x86_64: -938 bytes Note that for the MIPS architecture only an exception had to be made disabling the 'simple' calls for 'udhcp' (in networking/udhcp/common.h) because it made these files larger on MIPS. Signed-off-by: James Byrne <james.byrne@origamienergy.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* do not duplicate CONFIG_PID_FILE_PATH and ".pid" stringsDenys Vlasenko2019-03-171-2/+2
| | | | | | | | text data bss dec hex filename 981737 485 7296 989518 f194e busybox_old 981704 485 7296 989485 f192d busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* config: update size informationDenys Vlasenko2018-12-281-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* klogd: code shrinkDenys Vlasenko2018-07-311-4/+7
| | | | | | | function old new delta klogd_main 511 486 -25 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* klogd: better help textDenys Vlasenko2018-07-311-2/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* config: deindent all help textsDenys Vlasenko2017-07-211-13/+13
| | | | | | Those two spaces after tab have no effect, and always a nuisance when editing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Update menuconfig items with approximate applet sizesDenys Vlasenko2017-07-181-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: hopefully all setup_common_bufsiz() are in placeDenys Vlasenko2016-04-211-3/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: make bb_common_bufsiz1 1 kbyte, add capability to use bss tail for itDenys Vlasenko2016-04-211-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The config item is FEATURE_USE_BSS_TAIL. When it is off (default): function old new delta read_config 210 228 +18 doCommands 2279 2294 +15 ipneigh_list_or_flush 763 772 +9 ipaddr_list_or_flush 1256 1261 +5 display_process_list 1301 1306 +5 conspy_main 1378 1383 +5 do_lzo_compress 352 355 +3 do_lzo_decompress 565 567 +2 push 46 44 -2 inetd_main 2136 2134 -2 uevent_main 421 418 -3 addLines 97 92 -5 bb_common_bufsiz1 8193 1024 -7169 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 8/5 up/down: 62/-7181) Total: -7119 bytes text data bss dec hex filename 829850 4086 9080 843016 cdd08 busybox_old 829901 4086 1904 835891 cc133 busybox_unstripped FEATURE_USE_BSS_TAIL=y: read_config 210 228 +18 doCommands 2279 2294 +15 ipneigh_list_or_flush 763 772 +9 ipaddr_list_or_flush 1256 1261 +5 display_process_list 1301 1306 +5 conspy_main 1378 1383 +5 do_lzo_compress 352 355 +3 do_lzo_decompress 565 567 +2 inetd_main 2136 2134 -2 bb_common_bufsiz1 8193 - -8193 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 8/1 up/down: 62/-8195) Total: -8133 bytes text data bss dec hex filename 829850 4086 9080 843016 cdd08 busybox_old 829911 4086 880 834877 cbd3d busybox_unstripped FIXME: setup_common_bufsiz() calls are missing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Fix compiling with musl's utmp stubsKylie McClain2016-02-011-1/+0
| | | | | | | | | | | | | | | | | | | This patch fixes compiling busybox with FEATURE_UTMP and _WTMP enabled. musl, while not really support utmp/wtmp, provides stub functions, as well as variables such as _PATH_UTMP, so that programs using utmp or wtmp can still compile fine. My reasoning for this patch is that on Exherbo, I'm currently trying to get us to be able to use the same busybox config file for both glibc and musl systems, using utmp/wtmp on systems that support it, and using the stubs on musl without needing two different configs. As of latest musl git, it provides all utmp functions needed; 1.1.12 doesn't, but I sent a patch to Rich to add the utmp{,x}name functions expected to exist, which was merged into musl upstream. Signed-off-by: Kylie McClain <somasissounds@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sysklogd/*: convert to new-style "one file" appletsDenys Vlasenko2015-10-181-0/+33
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* klogd: handle multi-char log levelsPeter Korsgaard2013-01-051-5/+2
| | | | | | | | | | | | | | 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>
* CONFIG_PID_FILE_PATH: new configuration option for pidfile pathsAnthony G. Basile2012-12-191-0/+3
| | | | | | | | | | | | | | | 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>
* *: remove "Options:" string from help textsDenys Vlasenko2011-06-051-1/+0
| | | | | | | function old new delta packed_usage 28706 28623 -83 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* syslogd,klogd: better help textDenys Vlasenko2011-05-251-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* move remaining help text from include/usage.src.hPere Orga2011-04-111-0/+8
| | | | | Signed-off-by: Pere Orga <gotrunks@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* klogd: fix the problem of delayed handling of ^C and SIGTERMDenys Vlasenko2011-03-071-1/+30
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* klogd: do not log partial linesDenys Vlasenko2010-10-191-9/+10
| | | | | | | | function old new delta overlapping_strcpy 15 18 +3 klogd_main 438 436 -2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: make GNU licensing statement forms more regularDenys Vlasenko2010-08-161-1/+1
| | | | | | | 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>
* klogd: make it work on non-linux systemsJeremie Koenig2010-08-011-18/+110
| | | | | | | | | | | | 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>
* klogd: fix small buglet in previous commitDenis Vlasenko2008-11-191-0/+1
|
* klogctl: fix a problem where we don't terminate read data with '\0'Denis Vlasenko2008-11-191-20/+17
| | | | | | | | and then misinterpret it. Code shrink while at it. function old new delta klogd_main 404 362 -42
* watchdog: WDIOC_SETTIMEOUT accepts seconds, not millisecondsDenis Vlasenko2008-10-041-28/+43
| | | | | klogd: handle many lines at once, by Steve Bennett (steveb AT workware.net.au)
* *: rename ATTRIBUTE_XXX to just XXX.Denis Vlasenko2008-07-051-1/+1
|
* klogd: make help text more understandableDenis Vlasenko2008-06-061-16/+17
| | | | | | | | | | | | 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
* *: add -Wunused-parameter; fix resulting breakageDenis Vlasenko2008-03-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* less,klogd,syslogd,nc,tcpudp: exit on signal by killing itself, not exit(1)Denis Vlasenko2008-02-241-1/+1
| | | | | *: minor shrink
* libbb: introduce bb_signals and bb_signals_recursive,Denis Vlasenko2008-02-161-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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
* - fix conflicting decls of syslog related facilitynames and prioritynames tablesBernhard Reutner-Fischer2008-01-271-1/+1
|
* dmesg,klogd: make code more readableDenis Vlasenko2007-11-161-6/+7
| | | | | | libbb: explain why we declare klogctl libbb: move defs around so that order makes more sense
* add -fvisibility=hidden to CC flags, mark XXX_main functionsDenis Vlasenko2007-10-111-1/+1
| | | | | EXTERNALLY_VISIBLE. 5% size reduction of libbusybox.so
* don't pass argc in getopt32, it's superfluousDenis Vlasenko2007-08-181-1/+1
| | | | | | | | (add/remove: 0/0 grow/shrink: 12/131 up/down: 91/-727) Total: -636 bytes text data bss dec hex filename 773469 1058 11092 785619 bfcd3 busybox_old 772644 1058 11092 784794 bf99a busybox_unstripped
* *: BB_BANNER -> bb_banner (it is not a const or #define)!Denis Vlasenko2007-06-131-1/+1
| | | | | | | | | | | | correct_password: explain in detail why it is ok to use bb_banner fsck_minix: make it print bb version, not it's own (outdated/irrelevant) one Marginal size difference: text data bss dec hex filename 679119 2700 15632 697451 aa46b busybox_old 679091 2700 15632 697423 aa44f busybox_unstripped
* usage.c: remove reference to busybox.hDenis Vlasenko2007-05-261-1/+1
| | | | | *: s/include "busybox.h"/include "libbb.h"
* move everything to new NOMMU helpers, except udhcpDenis Vlasenko2007-03-261-6/+1
|
* NOMMU re-exec trick shuld not depend on existence of "don't daemonize"Denis Vlasenko2007-03-241-1/+2
| | | | | option for every affected applet (and dnsd, for example, don't have one). Thus rework re-exec support to not require it. Code got smaller too.
* klogd: code de-obfuscation with small code size reductionDenis Vlasenko2007-02-171-25/+20
|
* suppress warnings about easch <applet>_main() havingDenis Vlasenko2007-02-031-0/+1
| | | | no preceding prototype
* - shrink klogd a tiny bit.Bernhard Reutner-Fischer2007-01-091-9/+12
| | | | | | | Compile tested only, would have sent it to the list for review but they don't show up in the ML archives :-/ text data bss dec hex filename 533 0 0 533 215 sysklogd/klogd.o.orig 530 0 0 530 212 sysklogd/klogd.o
* klogd: small optimizationsDenis Vlasenko2007-01-041-24/+25
| | | | (btw, I looked into syslogd... that's frightening!)
* attempt to regularize atoi mess.Denis Vlasenko2006-10-081-2/+1
|
* getopt_ulflags -> getopt32.Denis Vlasenko2006-10-031-2/+2
| | | | | | | | It is impossible to formulate sane ABI based on size of ulong because it can be 32-bit or 64-bit. Basically it means that you cannot portably use more that 32 option chars in one call anyway... Make it explicit.
* Remove bb_ prefixes from xfuncs.c (and a few other places), consolidateRob Landley2006-08-031-8/+1
| | | | | | | | | | things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only had one user), clean up lots of #includes... General cleanup pass. What I've been doing for the last couple days. And it conflicts! I've removed httpd.c from this checkin due to somebody else touching that file. It builds for me. I have to catch a bus. (Now you know why I'm looking forward to Mercurial.)
* - move #include busybox.h to the very top so we pull in the configBernhard Reutner-Fischer2006-06-021-2/+1
| | | | and eventual platform specific includes in early.
* - shrink klogd a bitBernhard Reutner-Fischer2006-05-311-35/+37
| | | | | | text data bss dec hex filename 569 0 0 569 239 sysklogd/klogd.o.orig 537 0 0 537 219 sysklogd/klogd.o