NAME
sendsyslog,
sendsyslog2 —
send a message to syslogd
SYNOPSIS
#include
<sys/syslog.h>
#include <sys/types.h>
int
sendsyslog(const
void *msg, size_t
len);
int
sendsyslog2(const
void *msg, size_t
len, int
flags);
DESCRIPTION
The
sendsyslog()
and sendsyslog2() functions are used to transmit a
syslog(3) formatted message direct to
syslogd(8) without requiring the allocation of a socket.
The flags argument of
sendsyslog2()
accepts the LOG_CONS flag. If
LOG_CONS is specified, and
syslogd(8) is not accepting messages, the message will be sent
directly to the console. This is used internally by
syslog_r(3), so that messages can be sent during difficult
situations.
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:
- [
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
sendsyslog2() function call appeared in
OpenBSD 5.9.