xref: /freebsd/share/man/man9/devctl_notify.9 (revision 4b9d6057)
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.Dd September 22, 2020
25.Dt DEVCTL_NOTIFY 9
26.Os
27.Sh NAME
28.Nm devctl_notify
29.Nd Send a message, via devctl, to userland
30.Sh SYNOPSIS
31.In sys/devctl.h
32.Ft void
33.Fn devctl_notify "const char *system" "const char *subsystem" "const char *type" "const char *data"
34.Sh DESCRIPTION
35Send a notification to user land via
36.Xr devctl 4 .
37See
38.Xr devctl 4
39for the format of these messages.
40.Pp
41The
42.Nm
43function creates a string using the following template:
44.Bd -literal
45snprintf(buffer, sizeof(buffer), "!system=%s subsystem=%s type=%s",
46   system, subsystem, type);
47.Ed
48.Pp
49The
50.Va system ,
51.Va subsystem ,
52and
53.Va type
54pointers cannot be NULL.
55.Pp
56The
57.Va data
58argument may be NULL (for no additions) or a message formatted
59properly for
60.Xr devctl 4 .
61A space will be added to the above template and this argument copied
62verbatim to form the message passed to userland.
63Senders should balance between only passing data that userland can not
64discover itself and sending all the data userland will want to use to
65decide what to do with the message.
66.Pp
67The current total message length limit is just under 1kb.
68Senders should try to remain well below this limit.
69.Sh SEE ALSO
70.Xr devctl 4 ,
71.Xr devd 8
72.Sh AUTHORS
73This manual page was written by
74.An M. Warner Losh
75