DEVICE_GET_SOFTC(9)
π DEVICE_GET_SOFTC(9) β bestie, it's the kernel dev manual π
okay so this is DEVICE_GET_SOFTC(9), a page from the Kernel Developer's Manual, and it's literally just one lil function that you're gonna use constantly. no cap. let's get into it π«Ά
β¨ NAME β¨
device_get_softc β access driver private instance variables π
πΈ SYNOPSIS πΈ
#include <sys/param.h>
#include <sys/bus.h>
void *
device_get_softc(device_t dev);
π¦ DESCRIPTION π¦
So this function returns the driver-specific software context of dev. That's the softc, babe. π
The softc is automatically allocated and zeroed when the device is attached. iconic behaviour, honestly. it's also initialized and present when a device is probed, but β and this is the important part β it's subject to caveats as described in DEVICE_PROBE(9). so go read that one too, bestie, don't skip it π
The size of the allocation is determined by the device's driver_t information used to define the driver. and the softc typically encapsulates the state of this instance of the device. it's giving main character energy for your driver's data, fr fr.
π¨ Driver writers are discouraged from using their own softc management mechanisms. and not me begging you β driver writers should not copy such mechanisms found in drivers in the tree that predate this function. like. those are the old ways. leave them there. π
β RETURN VALUES β
The pointer to the driver-specific instance variable is returned. that's it, that's the whole return. a pointer. go wild. β¨
π SEE ALSO π
device(9)DEVICE_PROBE(9)device_set_softc(9)driver(9)
π AUTHORS π
This manual page was written by Doug Rabson. thank you Doug, king π
and that's the whole vibe check, bestie π this one came from the Debian fam and it's dated January 21, 2015. slay, go forth and grab your softc ππΈ
π¦ 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