xref: /freebsd/share/man/man9/devctl_notify.9 (revision 9768746b)
1.\"
2.\" Copyright (c) 2020 M Warner Losh
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
14.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
17.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23.\"
24.\" $FreeBSD$
25.\"
26.Dd September 22, 2020
27.Dt DEVCTL_NOTIFY 9
28.Os
29.Sh NAME
30.Nm devctl_notify
31.Nd Send a message, via devctl, to userland
32.Sh SYNOPSIS
33.In sys/devctl.h
34.Ft void
35.Fn devctl_notify "const char *system" "const char *subsystem" "const char *type" "const char *data"
36.Sh DESCRIPTION
37Send a notification to user land via
38.Xr devctl 4 .
39See
40.Xr devctl 4
41for the format of these messages.
42.Pp
43The
44.Nm
45function creates a string using the following template:
46.Bd -literal
47snprintf(buffer, sizeof(buffer), "!system=%s subsystem=%s type=%s",
48   system, subsystem, type);
49.Ed
50.Pp
51The
52.Va system ,
53.Va subsystem ,
54and
55.Va type
56pointers cannot be NULL.
57.Pp
58The
59.Va data
60argument may be NULL (for no additions) or a message formatted
61properly for
62.Xr devctl 4 .
63A space will be added to the above template and this argument copied
64verbatim to form the message passed to userland.
65Senders should balance between only passing data that userland can not
66discover itself and sending all the data userland will want to use to
67decide what to do with the message.
68.Pp
69The current total message length limit is just under 1kb.
70Senders should try to remain well below this limit.
71.Sh SEE ALSO
72.Xr devctl 4 ,
73.Xr devd 8
74.Sh AUTHORS
75This manual page was written by
76.An M. Warner Losh
77