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