Sync syslogd with FreBSD:
authorPeter Avalos <pavalos@theshell.com>
Sun, 15 Mar 2009 10:28:51 +0000 (00:28 -1000)
committerPeter Avalos <pavalos@theshell.com>
Tue, 7 Apr 2009 07:09:58 +0000 (21:09 -1000)
commitcc753ff342cfffc25e027978128fef027531be13
tree3bf152581aa9f9b9d7e53a1ad8e5204abe5b5e25
parent8e0fe426c36c399002241b07b29ee2cb153e0aa3
Sync syslogd with FreBSD:

* Add a flag, -T, that tells syslogd to always replace the timestamp on
messages from the network.  This option lets us replace timestamps that
are correctly formatted but wrong.

* Allow comment to be placed at the end of a configuration line.

* Add a -8 switch to syslogd to prevent it from mangling 8-bit data.

* Open ctty in non-blocking mode to avoid hangs during open and close.

* Handle "*" as a priority properly.

* Dynamically determine length vs. hardcoding it.

* Free the previous message buffer (f_prevline) only after logging all
the messages and just before the process exit.  Also check f_prevline for
NULL before using it.

* Add the ability to log to an arbitrary udp port as well as the
standard syslog port.

* Currently, if writing out a log entry fails, we unlink that log entry
from our internal list of logfiles. So if writev(2) fails for potentially
transient errors like ENOSPC, syslogd requires a restart, even if the
filesystem has purged.  This change allows syslogd to ignore ENOSPC
space errors, so that when the filesystem is cleaned up, syslogd will
automatically start logging again without requiring the reset.
This makes syslogd(8) a bit more reliable.

* Add -C option which tells syslogd(8) to create log files if they don't
exist.

* Add cases for ENOBUFS and ENETDOWN. We need to make sure that we
catch all transient errors. This fixes situations where transient
error conditions such as network interfaces losing carrier signals
or the system running out of mbufs would result in the permanent
removal of forwarding syslog messages.

* Add -S option which allows to change the pathname of the privileged
socket /var/run/logpriv.

* Check that supplied facility is not bigger than LOG_NFACILITIES.

* Allow ':' and '%' in hostname specifications so that we can specify
IPv6 addresses and scope IDs.

* Protect against local flooder of /var/run/log. Do not loop forever in
syslog(3) if we are a priveleged program (sshd, su, etc.).

  - Make syslogd open an additional socket /var/run/logpriv, with 0600
    permissions.
  - In libc, try to use this socket.
  - Do not loop forever if we are using this socket

* Use stailqueue for sockets instead of socket buffer. Thus remove
limit for 20 sockets.

* Add possibility to specify file mode for sockets created with '-l'.

* Check that socket name in '-l' is absolute.

* Make syslog(3) thread safe.
lib/libc/gen/syslog.c
sys/sys/syslog.h
usr.sbin/syslogd/Makefile
usr.sbin/syslogd/syslog.conf.5
usr.sbin/syslogd/syslogd.8
usr.sbin/syslogd/syslogd.c