]> git.ipfire.org Git - thirdparty/dhcpcd.git/commit - src/if-options.c
syslogd(8) may not always be running before dhcpcd so any startup errors are
authorRoy Marples <roy@marples.name>
Tue, 17 Mar 2015 23:46:38 +0000 (23:46 +0000)
committerRoy Marples <roy@marples.name>
Tue, 17 Mar 2015 23:46:38 +0000 (23:46 +0000)
commit069e2f284f3b9537bd2a1c87f0ee7d64cb559598
tree19144cc86d9756f037415d6e9ffec17b2bb1bf7e
parent30d2a5f522b506377e4ce176bd20e58299124ab3
syslogd(8) may not always be running before dhcpcd so any startup errors are
lost. Also, it's output with LOG_PERROR is ugly and LOG_PERROR isn't portable.

logger is a new function to solve the above which is identical to syslog(3)
but takes a dhcpcd_ctx for context so it functions in the RTEMS OS.
When writing to stdout/stderr or a given logfile, logger will convert %m
into the error string based on errno, just like syslog(3) does.
If your libc supports %m via printf, then define HAVE_PRINTF_M to remove
a fair chunk of code. There is no way of working out if your libc supports
this, especially in cross-compiled environment.
If the logfile is rotated, send dhcpcd a SIGUSR2 and the logfile will be
re-opened.

This does add about an exta 4K on 64-bit platforms so for size constraints
this can be compiled out by defining USE_LOGFILE to 0.
32 files changed:
arp.c
auth.c
common.c
common.h
compat/dprintf.c
compat/dprintf.h
configure
control.c
defs.h
dev.c
dhcp-common.c
dhcp.c
dhcp6.c
dhcpcd-run-hooks.in
dhcpcd.8.in
dhcpcd.c
dhcpcd.conf.5.in
dhcpcd.h
duid.c
eloop.c
eloop.h
if-bsd.c
if-linux-wext.c
if-linux.c
if-options.c
if-options.h
if.c
ipv4.c
ipv4ll.c
ipv6.c
ipv6nd.c
script.c