DEVCLASS_GET_DEVICES(9)
π DEVCLASS_GET_DEVICES π
okay bestie, so this one lives in the Kernel Developer's Manual (section 9, kernel devs only, iykyk) and it's literally just "hey, gimme all the devices in this devclass" π¦
β¨ NAME β¨
devclass_get_devices β get a list of devices in a devclass π
πΈ SYNOPSIS πΈ
#include <sys/param.h>
#include <sys/bus.h>
int
devclass_get_devices(devclass_t dc, device_t **devlistp,
int *devcountp);
like, you gotta include both of those headers, no skipping π
π DESCRIPTION π
So basically you call this and it retrieves a list of all device instances that are currently chillin' in the devclass, then hands you back:
- the list itself in
*devlistpπ - the count in
*devcountpπ’
β οΈ okay this part is IMPORTANT, no cap: the memory that gets allocated for that list has to be freed withfree(*devlistp, M_TEMP)β and yes, you do this even if*devcountpis0. Zero devices still means allocated memory, bestie. don't leak on me π
π RETURN VALUES π
Zero on success, slay β¨ otherwise it returns whatever appropriate error fits the situation. not zero = something went sideways, periodt.
π¦ SEE ALSO π¦
the girlies that go with this one π go read 'em, fr fr
π AUTHORS π
This manual page was written by Doug Rabson. iconic behavior honestly π
k bye this page came from the Debian crew, dated May 19, 2005, and it's DEVCLASS_GET_DEVICES(9) all the way through πβ¨
π¦ 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