- Let syslog_tst.c use local syslog.c API, for wrapping
- Add -DTESTING to build of syslog_tst & C:o
- Enable CLOEXEC on each opened log file in syslog.c
- Simplify code for readability
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
For compatibility with GLIBC <2.19 we only need to define _BSD_SOURCE,
and for compatibility with GLIBC >=2.19 we must defined _DEFAULT_SOURCE.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
On modern systems, both *BSD and Linux using GLIBC/musl, the signal's
disposition is not reset to SIG_DFL on invocation of its handler. On
Linux this is true because GLIBC/musl wraps signal() in sigaction()
with the same semantics as BSD.
A follow-up commit will refactor to use sigaction().
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
We always want to build with support for UNIX domain socket and remote
syslog (both receive and send). We can safely state that all systems
we aim to target supports FHS.
Also, start clean up gratuitous use of SYSV #ifdefs.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
No need to check for SYSV (?) to include fcntl.h since syslogd.c already
includes it unconditionally. If this turns out to be an actual problem
we should probe for fcntl.h in configure and use #ifdef HAVE_FCNTL_H.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch introduces a relicensed logit from the Finit[1] project. It
has been rebranded as logger to complement the features implemented in
the sysklogd project.
Note, logger conflicts with the tool of the same name from util-linux.
[1]: https://github.com/troglobit/finit
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
From upstream FreeBSD Subversion r165903:
"Per Regents of the University of Calfornia letter,
remove advertising clause."
This patch also includes the renumbering of the clauses, making
this codebase truly 3-clause BSD licensed.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch adds support for sending in RFC5424[1] style format to remote
log servers. Section 6.5[2] lists some examples, here's one:
<30>1 2019-10-12T18:21:01.123456+02:00 troglobit finit 321 - - Starting service 'firewalld:1'
Note, sysklogd currently does not support MSGID and structured data, see
the RFC for more information on this.
[1] - https://tools.ietf.org/html/rfc5424
[2] - https://tools.ietf.org/html/rfc5424#section-6.5
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch updates the sysklogd local copy of the GPL to the official
new/upstream GPL v2 license.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This applies to both the command line '-b SIZE' option and the
optional per log file setting. Modifiers supported are: k, M, G
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
These feature flags are required to build with modern GCC that default
to newser C standard. However, we should never enforce a standard on
the user -- there are far too many old/embedded systems out there with
very old toolchains that just want bug fixes and minor features for an
otherwise stable system.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
May need to build on/for systems with quite old GCC version. Also,
fixes build on Travis-CI. (Enabling C99 brings in a lot of other
warnings that we'll take care of at a later stage.)
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch adds support for rotating compressed files as well as
compressing (gzip) all files older than .1.
Props goes to @Znahoj for the first prototype implementation made at
Westermo. Only minor changes to his draft were made.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>