DEVICE_GET_CHILDREN(9)
π DEVICE_GET_CHILDREN π
okay bestie, welcome to section 9 of the Kernel Developer's Manual β yes, we're in the kernel dev manual, we're doing big brain stuff today, and honestly? it's giving main character energy. this is the page for device_get_children, and it's here to help you find out who's hanging out under a device. yes literally, its children. the whole little device family tree π³β¨
β¨ NAME β¨
device_get_children β get a list of devices connected to a device
like, the actual roster of who's attached. no cap. π
β¨ SYNOPSIS β¨
#include <sys/param.h>
#include <sys/bus.h>
int
device_get_children(device_t dev, device_t **devlistp, int *devcountp);
first you gotta pull in those headers, <sys/param.h> and <sys/bus.h>, and then boom β that's the function signature, exactly like that. don't freestyle it π«Ά
β¨ DESCRIPTION β¨
so here's the vibe: you call device_get_children and it retrieves a list of all the device instances that are currently connected to dev, and it hands you back that list in *devlistp plus the count in *devcountp. like, here's your kids, and here's how many there are π
π important, bestie: the memory allocated for that list? you gotta free it yourself with free(*devlistp, M_TEMP). the function is not gonna clean up after you. it's not your mom, it's a kernel function.
and one more thing β devlistp and devcountp are not changed when an error is returned. so if things go sideways, your pointers stay exactly where they were. no mystery edits. periodt.
β¨ RETURN VALUES β¨
Zero comes back on success, obviously, slay. otherwise an appropriate error is returned β so like, check your return value, bestie, don't just assume it worked π
β¨ SEE ALSO β¨
go read those too, iykyk π
β¨ AUTHORS β¨
this manual page was written by Doug Rabson. iconic behavior, we love a documented kernel π
and that's the whole page, bestie! this lil' beauty lives in the Debian build of the Kernel Developer's Manual and it was last dated August 23, 2008 β yes, it's been serving accurate kernel facts since way before you were cool. go forth and enumerate those children πΈπ¦β
π¦ 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