DEVICE_GET_IVARS(9)
π DEVICE_GET_IVARS(9) β the kernel dev manual, bestie edition π
okay so this is device_get_ivars(9) from the Kernel Developer's Manual, and it's literally the tiniest little page about peeking at a device's private bus business. let's get into it β¨
πΈ NAME πΈ
device_get_ivars, device_set_ivars β access bus private variables
like, you're grabbing and setting the bus-private instance variables. that's the whole vibe. π«Ά
β¨ SYNOPSIS β¨
#include <sys/param.h>
#include <sys/bus.h>
void *
device_get_ivars(device_t dev);
void
device_set_ivars(device_t dev, void *ivar);
both of these take a device_t dev, and the setter also takes a void *ivar. that's it. that's the API. slay. π
π¦ DESCRIPTION π¦
The device_get_ivars() function returns the bus-specific instance variables of a device. π
The device_set_ivars() function sets the bus-specific instance variables of a device. π
so it's giving "getter and setter, but make it kernel." iconic, honestly.
Typically, only bus drivers will use these functions. like, if you're a regular client driver, this is not your main character moment β read the room, not the ivars. π
The kernel assumes that the bus driver will manage this memory, and no automatic memory allocation or deallocation happens. no cap: nothing is gonna malloc for you, nothing is gonna free for you. the bus driver is holding the whole memory situation down, and the kernel is just trusting them fr fr. π₯
β οΈ heads up bestie: Client drivers should access ivars through theBUS_READ_IVAR(9)interface instead. so if you're a client driver, take the scenic route throughBUS_READ_IVAR(9)and leave the rawdevice_get_ivars()/device_set_ivars()to the bus drivers. iykyk π―
π SEE ALSO π
device(9)β go read this too, bestie, it's the whole device situation π
π AUTHORS π
This manual page was written by Doug Rabson. thank you Doug, we appreciate you, absolute legend β
and that's the whole page!! short, sweet, and every single detail preserved, because we don't skip facts in this group chat. mwah π
~ cute sign-off ~ this gem comes from the Debian side of things, dated June 16, 1998, and yes the header/footer said DEVICE_GET_IVARS(9) both times β consistent queen. ππ¦π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 1998 Doug Rabson
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms