Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
SENDSYSLOG(2)		  FreeBSD System Calls Manual		 SENDSYSLOG(2)

NAME
     sendsyslog	-- send	a message to syslogd

SYNOPSIS
     #include <sys/syslog.h>
     #include <sys/types.h>

     int
     sendsyslog(const char *msg, size_t	len, int flags);

DESCRIPTION
     The sendsyslog() function is used to transmit a syslog(3) formatted mes-
     sage 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	ac-
     cepting 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, up to	100 messages are
     stashed in	the kernel.  After that, dropped messages are counted.	When
     syslogd(8)	works again, before the	next message, stashed messages and
     possibly a	warning	with the drop counter, error number, and pid 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.  Af-
     ter that the messages can 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.

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 pa-
			rameter.

     [EMSGSIZE]		The socket requires that message be sent atomically,
			and the	size of	the message to be sent made this im-
			possible.

     [ENOBUFS]		The system was unable to allocate an internal buffer.
			The operation may succeed when buffers become avail-
			able.

     [ENOTCONN]		The message cannot be sent, likely because syslogd(8)
			is not running.

SEE ALSO
     syslog_r(3), syslogd(8)

HISTORY
     The sendsyslog() function call appeared in	OpenBSD	5.6.  The flags	argu-
     ment was added in OpenBSD 6.0.

FreeBSD	13.0			 March 9, 2021			  FreeBSD 13.0

NAME | SYNOPSIS | DESCRIPTION | RETURN VALUES | ERRORS | SEE ALSO | HISTORY

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=sendsyslog&sektion=2&manpath=OpenBSD+6.9>

home | help