Commit Graph

853 Commits

Author SHA1 Message Date
Joachim Wiberg
0901310226 Load or reload timezone data on init/SIGHUP
This should fix any lingering issues with logging with the wrong
timezone at boot.  As long as syslogd gets HUP'ed after setting
the new timezone.

Improvements to this welcome, of course.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-21 11:47:42 +01:00
Joachim Wiberg
f54c1d1f30 Fix issue with parsing /dev/kmsg time, off by one error
Problem and proposed fix reported by opty on #troglobit at freenode.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-21 11:46:09 +01:00
Joachim Wiberg
b115c7ec4e Uppdate changelog and bump version for v2.2.1 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-30 14:21:59 +01:00
Joachim Wiberg
23f779ee0e Add .sha256 checksum to release target
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-30 14:21:59 +01:00
Joachim Wiberg
324c489b23 configure: use $ac_default_prefix as default install prefix
Follow-up to 22d26c5 to avoid hard-coding and instead using the
internal prefix variable, that can be changed/overridden by the
correct APIs.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-27 07:44:03 +01:00
Joachim Wiberg
fb573fe0ae Update ChangeLog for upcoming v2.2.1 patch release
Initial release date, Saturday Jan 30, 2021.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-27 00:09:05 +01:00
Joachim Wiberg
d2444c720f Fix #27: bug in /dev/kmsg priority parser, intrdocued in v2.2.0
This patch fixes a bug in the kernel log priority parser introduced in
v2.2.0 with the new support for /dev/kmsg, replacing /proc/kmsg which
has another format for the log priority.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-26 22:04:49 +01:00
Joachim Wiberg
3c59234dab Bump version for upcoming v2.2.1 bug fix release, -beta1
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-25 00:13:43 +01:00
Joachim Wiberg
406e4299a1 logger: No need for appending error message, err() already does this
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-25 00:13:06 +01:00
Joachim Wiberg
ea2565ce4e Drop %m gnuism from internal log macro
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-25 00:13:06 +01:00
Joachim Wiberg
3e4000b25a Fix #26: handle Linux EPIPE on /dev/kmsg
When Linux CONFIG_LOG_BUF_SHIFT is set too low, or too many messages are
generated by the kernel, /dev/kmsg will overflow.  This is signaled with
EPIPE to userspace.  We can use the seqnos to figure out how many we've
lost, but seqnos are currently ignored.

> In case records get overwritten while /dev/kmsg is held open, or
> records get faster overwritten than they are read, the next read()
> will return -EPIPE and the current reading position gets updated to
> the next available record. The passed sequence numbers allow the log
> consumer to calculate the amount of lost messages.

-- https://lwn.net/Articles/490690/

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-25 00:12:29 +01:00
Joachim Wiberg
22d26c5945 Restore default configure prefix, from / to /usr/local
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-23 23:09:59 +01:00
Joachim Wiberg
df46facfb9 Bump version for v2.2.0 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-15 11:16:23 +01:00
Joachim Wiberg
45085709e8 Update copyright years
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-15 11:16:04 +01:00
Joachim Wiberg
dbdc1cdf91 test: Update fwd.sh to ignore kernel logs
With the new support for /dev/kmsg the tests can run on a system that
already has a syslog daemon, and still receive all kernel messages.  We
want to ignore those in this (all?) tests and focus on the forwarding of
messages between two sysklogd.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-15 09:40:31 +01:00
Joachim Wiberg
5a42a72721 Update ChangeLog for release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-15 09:17:02 +01:00
Joachim Wiberg
54da74ba4c Ignore GNU global ID files
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-15 08:59:47 +01:00
Joachim Wiberg
fb4412b62c .github: Disable silent rules in build, use install-strip
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-14 18:48:30 +01:00
Joachim Wiberg
a95c4baeda Prepare ChangeLog for v2.2.0 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-14 15:29:01 +01:00
Joachim Wiberg
680c622efb Fix GCC init warning on ArmV5, use memset() instead
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-14 15:21:11 +01:00
Joachim Wiberg
af0da3cf1d Update, generated files by Buildroot and Emacs
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-14 12:53:46 +01:00
Joachim Wiberg
883b351351 Allow loop initial declarations, explicitly enable C99
Fixes the following error on certain buildroot toolchains:

    syslogd.c: In function 'fmt5424':
    syslogd.c:1583:2: error: 'for' loop initial declarations are only allowed in C99 mode
      for (int j = 25; j >= 20; --j) {
           ^

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-14 12:50:51 +01:00
Joachim Wiberg
f735f54714 Adjust repology listing below logo, messes up new GitHub layout
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2020-08-31 23:11:06 +02:00
Joachim Wiberg
1882a1bdc1 Revert "Travis-CI: Disable clang for Coverity Scan run"
This reverts commit 88705a2e62.
2020-08-31 23:09:52 +02:00
Joachim Wiberg
88705a2e62 Travis-CI: Disable clang for Coverity Scan run
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2020-08-31 23:02:03 +02:00
Joachim Wiberg
30842595d5 Update copyright years and author last name
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2020-08-31 21:28:45 +02:00
Joachim Wiberg
a719f66bdd Start v2.2.0 dev cycle
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2020-08-31 21:28:45 +02:00
Joachim Wiberg
5aa7372f4c Fix #19: Prefer /dev/kmsg over /proc/kmsg on Linux
This patch migrates the sysklogd project to use the modern /dev/kmsg
interface on Linux.  There are many advantages over the older /proc
interface; 1) no need to wait for /proc to be mounted, 2) it provides
multiple simultaneous access.  For more information, see:

  https://www.kernel.org/doc/Documentation/ABI/testing/dev-kmsg

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2020-08-31 21:28:45 +02:00
Joachim Wiberg
93117e5801 Define _GNU_SOURCE, required for O_CLOEXEC on uClibc
When building sysklogd on a uClibc system we must define _GNU_SOURCE to
get O_CLOEXEC.

Since _GNU_SOURCE is also required for asprintf() with GLIBC, as used by
the pidfile() replacement function, we drop it from there and rely on
AM_CPPFLAGS for all sources.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2020-08-30 11:43:53 +02:00
Joachim Wiberg
91a51cffbe Merge branch 'sandy-lcq-master'
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2020-08-27 08:10:15 +02:00
Changqing Li
e684939559 Makefile.am: fixup issue #17
only make $(LIBOBJS) depend on $(LTLIBOBJS) still have race condition,
library like pidfile.o may be changed when compile or link for target
libsyslog_la_LIBADD, which will cause problem like below:

ERROR: dwarfsrcfiles failed with exit code 1 (cmd was ['dwarfsrcfiles', /tmp/work/ppc7400-oe-linux/sysklogd/2.1.2-r0/package/usr/lib/libsyslog.a']):
dwarfsrcfiles: tmp/work/ppc7400-oe-linux/sysklogd/2.1.2-r0/package/usr/lib/libsyslog.a: not a valid ELF file

arm-oe-linux-gnueabi-libtool: link: arm-oe-linux-gnueabi-gcc  -march=armv7ve -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=TOPDIR/tmp-glibc/work/armv7vet2hf-neon-oe-linux-gnueabi/sysklogd/2.1.2-r0/recipe-sysroot -shared  -fPIC -DPIC  .libs/libsyslog_la-syslog.o ../lib/.libs/pidfile.o ../lib/.libs/strlcpy.o ../lib/.libs/strlcat.o    -march=armv7ve -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=TOPDIR/tmp-glibc/work/armv7vet2hf-neon-oe-linux-gnueabi/sysklogd/2.1.2-r0/recipe-sysroot -O2 -g -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed   -Wl,-soname -Wl,libsyslog.so.0 -o .libs/libsyslog.so.0.0.0
arm-oe-linux-gnueabi-libtool: link: (cd ".libs" && rm -f "libsyslog.so.0" && ln -s "libsyslog.so.0.0.0" "libsyslog.so.0")
arm-oe-linux-gnueabi-libtool: link: (cd ".libs" && rm -f "libsyslog.so" && ln -s "libsyslog.so.0.0.0" "libsyslog.so")
arm-oe-linux-gnueabi-libtool: link: arm-oe-linux-gnueabi-gcc-ar cru .libs/libsyslog.a  libsyslog_la-syslog.o ../lib/pidfile.o ../lib/strlcpy.o ../lib/strlcat.o
TOPDIR/tmp-glibc/work/armv7vet2hf-neon-oe-linux-gnueabi/sysklogd/2.1.2-r0/recipe-sysroot-native/usr/bin/arm-oe-linux-gnueabi/../../libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/10.1.0/ar: `u' modifier ignored since `D' is the default (see `U')
TOPDIR/tmp-glibc/work/armv7vet2hf-neon-oe-linux-gnueabi/sysklogd/2.1.2-r0/recipe-sysroot-native/usr/bin/arm-oe-linux-gnueabi/../../libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/10.1.0/ar: ../lib/strlcat.o: No such file or directory

Signed-off-by: Changqing Li <changqing.li@windriver.com>
2020-08-27 11:40:44 +08:00
Joachim Nilsson
52c5384817 Minor, adjust position
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-05-21 10:32:18 +02:00
Joachim Nilsson
121d6cbaee Minor, repology badge
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-05-21 10:31:22 +02:00
Joachim Nilsson
84115ed4a8
Create FUNDING.yml 2020-04-04 14:05:58 +02:00
Joachim Nilsson
6d6010add6 Update ChangeLog and bump version for v2.1.2 release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-03-22 09:47:54 +01:00
Joachim Nilsson
5eec48df9d Minor, wording and formatting of comment
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-03-22 09:47:01 +01:00
Joachim Nilsson
4c9ede6e43
Merge pull request #18 from sandy-lcq/master
fix one rarely reproduced parallel build problem
2020-03-20 16:28:47 +01:00
Changqing Li
b88e21d177 fix one rarely reproduced parallel build problem
fix for this issue:
https://github.com/troglobit/sysklogd/issues/17

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Changqing Li <changqing.li@windriver.com>
2020-03-20 16:52:41 +08:00
Joachim Nilsson
b216a6a0bf Travis-CI: Move to Ubuntu 18.04 for building and testing
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-03-12 19:18:15 +01:00
Joachim Nilsson
24dafe9a27 Update ChangeLog and bump version for v2.1.1 bug fix release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-19 21:21:57 +01:00
Joachim Nilsson
c20c748afa Workaround for weird automake buglet
The `make distcheckclean` command fails because of lingering .o files in
lib/.libs/ which it shouldn't, since both AC_CONFIG_LIBOBJ_DIR() and the
subdir-objects automake options are set.

This workaround is ugly, but works for now.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-19 21:21:57 +01:00
Joachim Nilsson
6da50d15f7 syslogd: Minor, reduce scope of local variables
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-19 19:59:37 +01:00
Joachim Nilsson
f35aa0760e syslogd: Minor, reduce code duplication
Found by clang-tidy

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-19 19:59:21 +01:00
Joachim Nilsson
d94163d721 Add unit test to check syslog.conf rule option parsing
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-19 10:46:59 +01:00
Joachim Nilsson
d22f7168e0 Revert "syslogd: cfopts(): reinit strtok() so both OPT1,OPT2 are found"
This reverts commit d758581 since it breaks unit tests by missing the
first option after ;

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-19 10:30:25 +01:00
Steffen Nurpmeso
d75858100c syslogd: cfopts(): reinit strtok() so both OPT1,OPT2 are found
Signed-off-by: Steffen Nurpmeso <steffen@sdaoden.eu>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-19 09:32:30 +01:00
Joachim Nilsson
ee47b88cd2 Follow-up to 84d70e6, fix spelling
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-19 09:11:15 +01:00
Joachim Nilsson
64257d689d Minor, cleanup/coding-style
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-19 09:10:58 +01:00
Joachim Nilsson
5fce3001ed Simplify handling of replacement functions; strlcpy() & C:o
- Drop weak bindings, use simple #define in compat.h instead
- No need to #ifdef sources with HAVE_foo, configure handles this for us
- Move utimensat() declaration to compat.h from pidfile.c to be consistent

With these changes we can let libsyslog link with the replacement objs,
just like syslogd and logger does.  Because even if the C-library does
*not* have strlcpy() & C:o *and* an application has a local copy of any
of these APIs, our versions are prefixed with __ in the symbol table.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-19 09:08:48 +01:00
Joachim Nilsson
de4c349930 Update ChangeLog for v2.1.1 bug fix release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-17 13:34:35 +01:00