NAME
sendsyslog —
send a message to syslogd
SYNOPSIS
#include
<sys/syslog.h>
#include <sys/types.h>
int
sendsyslog(const
void *msg, size_t
len, int
flags);
DESCRIPTION
The
sendsyslog()
function is used to transmit a
syslog(3) formatted message direct to
syslogd(8) without requiring the allocation of a socket. 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.
RETURN VALUES
Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error.
ERRORS
sendsyslog() can fail if:
- [
EFAULT] - An invalid user space address was specified for a parameter.
- [
EMSGSIZE] - The socket requires that message be sent atomically, and the size of the message to be sent made this impossible.
- [
ENOBUFS] - The system was unable to allocate an internal buffer. The operation may succeed when buffers become available.
- [
ENOTCONN] - The message cannot be sent, likely because syslogd(8) is not running.
SEE ALSO
HISTORY
The sendsyslog() function call appeared in
OpenBSD 5.6. The flags
argument was added in OpenBSD 6.0.