DEVCTL_NOTIFY(9)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ’Œ DEVCTL_NOTIFY ✨

okay so welcome to the manual page for devctl_notify, straight out of the Kernel Developer's Manual β€” yes bestie, we're in kernel land now, put your hair up πŸŽ€


🌸 NAME 🌸

devctl_notify β€” literally the function that sends a message to userland via devctl, no cap πŸ’…


✨ SYNOPSIS ✨

#include <sys/devctl.h>

void
devctl_notify(const char *system, const char *subsystem,
    const char *type, const char *data);

that's the whole thing, she's a void, she returns nothing, she just sends πŸ¦‹


πŸ’– DESCRIPTION πŸ’–

So what does she do? devctl_notify sends a notification to user land through devctl(4). And if you wanna know what these messages actually look like, go read devctl(4) β€” that's where the format lives, iykyk πŸ“¬

The function builds a string from this exact template, copying it character for character:

snprintf(buffer, sizeof(buffer), "!system=%s subsystem=%s type=%s",
   system, subsystem, type);

Now listen closely bestie, this part is important πŸ‘‘ β€” the system, subsystem, and type pointers cannot be NULL. Like, not allowed. Don't do it. Periodt.

The data argument is different though β€” that one may be NULL, which means "no additions", thank you very much. Or it can be a message formatted properly for devctl(4). Here's the deal: a space gets added onto that template up there, and then this argument is copied verbatim to form the message that gets passed to userland. Copy-paste energy, no editing, no vibes check on the contents πŸ”₯

And here's the part where senders gotta have some self-awareness: balance it out, okay? Pass only the data that userland genuinely can't discover on its own, but also make sure you're sending everything userland will actually want so it can decide what to do with the message. It's giving "just enough, never too much" πŸ’…

⚠️ Heads up: the current total message length limit is just under 1kb. Senders should really try to stay well below that limit β€” like, don't be out here testing the ceiling, bestie 😭

πŸ¦‹ SEE ALSO πŸ¦‹

go read those, they're the moment, they're the icon, they're the blueprint 🌈


🫢 AUTHORS 🫢

This manual page was written by M. Warner Losh β€” thank you for your service, king πŸ‘‘


and that's the whole page, bestie!! no crumbs left, every flag and caveat intact, we ate and left zero notes πŸ’œ

signing off from the Debian edition of this page, dated September 22, 2020 β€” mwah, see you in the kernel πŸ’‹βœ¨

πŸ“¦ where this page comes from