16b1d2116SWarner Losh.\" 26b1d2116SWarner Losh.\" Copyright (c) 2020 M Warner Losh 36b1d2116SWarner Losh.\" 46b1d2116SWarner Losh.\" Redistribution and use in source and binary forms, with or without 56b1d2116SWarner Losh.\" modification, are permitted provided that the following conditions 66b1d2116SWarner Losh.\" are met: 76b1d2116SWarner Losh.\" 1. Redistributions of source code must retain the above copyright 86b1d2116SWarner Losh.\" notice, this list of conditions and the following disclaimer. 96b1d2116SWarner Losh.\" 2. Redistributions in binary form must reproduce the above copyright 106b1d2116SWarner Losh.\" notice, this list of conditions and the following disclaimer in the 116b1d2116SWarner Losh.\" documentation and/or other materials provided with the distribution. 126b1d2116SWarner Losh.\" 136b1d2116SWarner Losh.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR 146b1d2116SWarner Losh.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 156b1d2116SWarner Losh.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 166b1d2116SWarner Losh.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 176b1d2116SWarner Losh.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 186b1d2116SWarner Losh.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 196b1d2116SWarner Losh.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 206b1d2116SWarner Losh.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 216b1d2116SWarner Losh.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 226b1d2116SWarner Losh.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 236b1d2116SWarner Losh.\" 246b1d2116SWarner Losh.Dd September 22, 2020 256b1d2116SWarner Losh.Dt DEVCTL_NOTIFY 9 266b1d2116SWarner Losh.Os 276b1d2116SWarner Losh.Sh NAME 286b1d2116SWarner Losh.Nm devctl_notify 296b1d2116SWarner Losh.Nd Send a message, via devctl, to userland 306b1d2116SWarner Losh.Sh SYNOPSIS 316b1d2116SWarner Losh.In sys/devctl.h 326b1d2116SWarner Losh.Ft void 336b1d2116SWarner Losh.Fn devctl_notify "const char *system" "const char *subsystem" "const char *type" "const char *data" 346b1d2116SWarner Losh.Sh DESCRIPTION 356b1d2116SWarner LoshSend a notification to user land via 366b1d2116SWarner Losh.Xr devctl 4 . 376b1d2116SWarner LoshSee 386b1d2116SWarner Losh.Xr devctl 4 396b1d2116SWarner Loshfor the format of these messages. 406b1d2116SWarner Losh.Pp 416b1d2116SWarner LoshThe 426b1d2116SWarner Losh.Nm 436b1d2116SWarner Loshfunction creates a string using the following template: 446b1d2116SWarner Losh.Bd -literal 456b1d2116SWarner Loshsnprintf(buffer, sizeof(buffer), "!system=%s subsystem=%s type=%s", 466b1d2116SWarner Losh system, subsystem, type); 476b1d2116SWarner Losh.Ed 486b1d2116SWarner Losh.Pp 496b1d2116SWarner LoshThe 506b1d2116SWarner Losh.Va system , 516b1d2116SWarner Losh.Va subsystem , 526b1d2116SWarner Loshand 536b1d2116SWarner Losh.Va type 546b1d2116SWarner Loshpointers cannot be NULL. 556b1d2116SWarner Losh.Pp 566b1d2116SWarner LoshThe 576b1d2116SWarner Losh.Va data 586b1d2116SWarner Loshargument may be NULL (for no additions) or a message formatted 596b1d2116SWarner Loshproperly for 606b1d2116SWarner Losh.Xr devctl 4 . 616b1d2116SWarner LoshA space will be added to the above template and this argument copied 626b1d2116SWarner Loshverbatim to form the message passed to userland. 636b1d2116SWarner LoshSenders should balance between only passing data that userland can not 646b1d2116SWarner Loshdiscover itself and sending all the data userland will want to use to 656b1d2116SWarner Loshdecide what to do with the message. 666b1d2116SWarner Losh.Pp 676b1d2116SWarner LoshThe current total message length limit is just under 1kb. 686b1d2116SWarner LoshSenders should try to remain well below this limit. 696b1d2116SWarner Losh.Sh SEE ALSO 706b1d2116SWarner Losh.Xr devctl 4 , 716b1d2116SWarner Losh.Xr devd 8 726b1d2116SWarner Losh.Sh AUTHORS 736b1d2116SWarner LoshThis manual page was written by 746b1d2116SWarner Losh.An M. Warner Losh 75