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