SENDSYSLOG(2) | System Calls Manual | SENDSYSLOG(2) |
sendsyslog
—
#include <sys/syslog.h>
#include <sys/types.h>
int
sendsyslog
(const
char *msg, size_t
len, int
flags);
sendsyslog
() function is used to transmit a
syslog(3) formatted message direct to
syslogd(8) without requiring the
allocation of a socket. The msg is not NUL terminated
and its len is limited to 8192 bytes. If
LOG_CONS
is specified in the
flags argument, and
syslogd(8) is not accepting messages, the
message will be sent to the console. This is used internally by
syslog_r(3), so that messages can be sent
during difficult situations. If sending to
syslogd(8) fails, dropped messages are
counted. When syslogd(8) works again, a
warning with the counter and error number is logged.
To receive messages from the kernel,
syslogd(8) has to create a datagram
socket pair and register one end. This registration is done by opening the
/dev/klog device and passing one file descriptor of
the socket pair as argument to ioctl(2)
LIOCSFD
invoked on the klog file descriptor. After
that the messages can be be read from the other end of the socket pair. By
utilizing /dev/klog the access to log messages is
limited to processes that may open this device.
sendsyslog
() can fail if:
EFAULT
]EMSGSIZE
]ENOBUFS
]ENOTCONN
]sendsyslog
() function call appeared in
OpenBSD 5.6. The flags argument
was added in OpenBSD 6.0.September 27, 2017 | OpenBSD-current |