1.\" $OpenBSD: sendsyslog.2,v 1.8 2016/03/22 13:09:08 bluhm Exp $ 2.\" 3.\" Copyright (c) 2014 Theo de Raadt 4.\" 5.\" Permission to use, copy, modify, and distribute this software for any 6.\" purpose with or without fee is hereby granted, provided that the above 7.\" copyright notice and this permission notice appear in all copies. 8.\" 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" 17.Dd $Mdocdate: March 22 2016 $ 18.Dt SENDSYSLOG 2 19.Os 20.Sh NAME 21.Nm sendsyslog 22.Nd send a message to syslogd 23.Sh SYNOPSIS 24.In sys/syslog.h 25.In sys/types.h 26.Ft int 27.Fn sendsyslog "const void *msg" "size_t len" "int flags" 28.Sh DESCRIPTION 29The 30.Fn sendsyslog 31function is used to transmit a 32.Xr syslog 3 33formatted message direct to 34.Xr syslogd 8 35without requiring the allocation of a socket. 36If 37.Dv LOG_CONS 38is specified in the 39.Fa flags 40argument, and 41.Xr syslogd 8 42is not accepting messages, the message will be sent to the console. 43This is used internally by 44.Xr syslog_r 3 , 45so that messages can be sent during difficult situations. 46If sending to 47.Xr syslogd 8 48fails, dropped messages are counted. 49When 50.Xr syslogd 8 51works again, a warning with the counter and error number is logged. 52.Sh RETURN VALUES 53.Rv -std 54.Sh ERRORS 55.Fn sendsyslog 56can fail if: 57.Bl -tag -width Er 58.It Bq Er EFAULT 59An invalid user space address was specified for a parameter. 60.It Bq Er EMSGSIZE 61The socket requires that message be sent atomically, 62and the size of the message to be sent made this impossible. 63.It Bq Er ENOBUFS 64The system was unable to allocate an internal buffer. 65The operation may succeed when buffers become available. 66.It Bq Er ENOTCONN 67The message cannot be sent, likely because 68.Xr syslogd 8 69is not running. 70.El 71.Sh SEE ALSO 72.Xr syslog_r 3 , 73.Xr syslogd 8 74.Sh HISTORY 75The 76.Fn sendsyslog 77function call appeared in 78.Ox 5.6 . 79The 80.Fa flags 81argument was added in 82.Ox 6.0 . 83