DEVICE_ATTACH(9)
π DEVICE_ATTACH π
okay bestie, gather round, because we're talking about the DEVICE_ATTACH(9) manual page from the Kernel Developer's Manual, and honestly? it's giving glow up for your hardware. π¦
β¨ NAME β¨
DEVICE_ATTACH β attach a device π
πΈ SYNOPSIS πΈ
#include <sys/param.h>
#include <sys/bus.h>
int
DEVICE_ATTACH(device_t dev);
like, that's it. two headers, one function, zero drama. β¨
π DESCRIPTION π
so here's the tea, bestie π« β you call DEVICE_ATTACH() to attach a device to the system, but ONLY after the DEVICE_PROBE() method has already been called and has said "yeah, this device exists." no cap, the probe has to go first. π
once you're in there, the DEVICE_ATTACH() method has two jobs and it does NOT half-do them:
- it should initialize the hardware π₯
- and it should allocate other system resources β think stuff like
devfs(5)entries β¨
and here's the part that's lowkey iconic: devices that implement buses should use this method to probe for the existence of devices attached to the bus, and then add them as children. π
and if you pair that with bus_generic_attach(9)? the child devices will be automatically probed AND attached. it's giving hands-free parenting. π§ periodt.
π RETURN VALUES π
- Zero is returned on success β
- otherwise, an appropriate error is returned π
that's the whole vibe check. zero = slay, anything else = something went sideways.
π₯ SEE ALSO π₯
go read those too, iykyk π
π AUTHORS π
This manual page was written by Doug Rabson <dfr@FreeBSD.org>. absolute main character energy, we stan. π«Ά
and that's the whole page, bestie! this version came to you courtesy of the Debian manual, dated January 15, 2017, and the original title was of course DEVICE_ATTACH(9) from the Kernel Developer's Manual. go forth and attach responsibly ππβ
π¦ 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