DEVICE_GET_DEVCLASS(9)
π DEVICE_GET_DEVCLASS π
okay bestie, so this is a page from the Kernel Developer's Manual (section 9, iykyk) and it's literally the tiniest little bop β one function, in and out, no drama. β¨
πΈ NAME πΈ
device_get_devclass β access the devclass of a device
like... it gets you the devclass. of a device. that's the whole vibe. π
β¨ SYNOPSIS β¨
first you gotta pull in the headers, no skipping:
#include <sys/param.h>
#include <sys/bus.h>
and then the moment we've all been waiting for:
devclass_t
device_get_devclass(device_t dev);
look at her. she's iconic. she takes one device_t dev and she gives you back a devclass_t. that's it. that's the function. π
π¦ DESCRIPTION π¦
okay so here's what's happening: device_get_devclass returns the current devclass that's associated with the device. like, whatever devclass that device is vibing with right now? that's what you get back. simple. clean. no cap. π
but β and this is the important bit, don't skip it β if the device has no devclass, then NULL is returned. not an error, not a crash, just NULL. so fr fr, check your return value before you go using it, bestie. π
lowkey a "no devclass" situation is just a thing that can happen, and the function handles it by handing you NULL. that's not a bug, that's the documented behaviour. periodt.
π SEE ALSO π
go read those too, they're the supporting cast and they ate. π₯
π AUTHORS π
this manual page was written by Doug Rabson. thank you Doug, you legend, we appreciate you π«Ά
and that's the whole page, bestie!! short, sweet, and honestly kind of a serve for how small it is. now go forth and get those devclasses. mwah π
this lil cutie comes from the Debian distro, dated June 16, 1998 β yeah she's vintage, she's been serving the kernel girlies since before we were born and she's still relevant. slay πβ¨
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 1998 Doug Rabson
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms