DEVICE_DETACH(9)
π DEVICE_DETACH(9) β the kernel developer's manual, but make it cute β¨
okay bestie, welcome to the DEVICE_DETACH page of the Kernel Developer's Manual π«Ά this one's short and sweet and honestly kind of iconic, so let's get into it π
β¨ NAME β¨
DEVICE_DETACH β detach a device π¦
like... it's detaching the device. that's the whole thing. periodt.
πΈ SYNOPSIS πΈ
#include <sys/param.h>
#include <sys/bus.h>
int
DEVICE_DETACH(device_t dev);
yes bestie, those includes are <sys/param.h> and <sys/bus.h>, and the signature is literally int DEVICE_DETACH(device_t dev); β no cap π―
π« DESCRIPTION π«
so what are we actually doing here? we're detaching a device π and there's two main character scenarios where you'd call this:
- the user is replacing the driver software π
- the device is about to be physically removed from the system π β like for
pccard(4)devices, iykyk
and here's the part where you have to be a responsible queen π β the method should:
- deallocate any system resources allocated during the
DEVICE_ATTACH(9)method π§Ή - reset the hardware to a sane state β i.e., disable interrupts etc. β‘
bestie please actually do the cleanup π leaving resources hanging is NOT the vibe. clean up after yourself like a grown-up π
π RETURN VALUES π
- Zero is returned on success β¨
- otherwise, an appropriate error is returned π
that's it. that's the return value section. slay.
π SEE ALSO π
the whole friend group fr fr π«Ά go read DEVICE_ATTACH(9) next, it's literally the other half of this story π
π§ AUTHORS π§
This manual page was written by Doug Rabson π absolute legend, we stan π
and that's a wrap bestie β¨ this page came from the Debian crew, dated June 16, 1998 β like, vintage vintage π β and it lives in the DEVICE_DETACH(9) slot of the Kernel Developer's Manual. detach responsibly, love u, bye π
π¦
π¦ 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