BUS_CHILD_PRESENT(9)
π BUS_CHILD_PRESENT(9) π
okay bestie, welcome to the Kernel Developer's Manual page for bus_child_present β yes it's a section 9 function, yes it's giving real low-level energy, and yes you're gonna understand it. let's go β¨
πΈ NAME πΈ
bus_child_present β ask the bus driver to see if this device is still really present
like, actually present. not "present in theory". present present. π«Ά
π SYNOPSIS π
#include <sys/param.h>
#include <sys/bus.h>
#include <machine/bus.h>
#include <sys/rman.h>
#include <machine/resource.h>
int
bus_child_present(device_t dev);
π DESCRIPTION π
so the way that bus_child_present() works is: it asks the parent device driver of dev to go check whether the hardware that dev represents is still physically accessible right now. like, right this second. β°
and ngl, "accessible" is a bit of a vibe-check situation β it varies from bus to bus. but generally speaking, hardware that isn't accessible cannot be accessed via the bus_space*() methods that you'd otherwise be using to poke at the device. so if it's not accessible, those methods aren't gonna save you. π
π¨ also important bestie: this does not ask the question "does this device have children?" β that's a whole different question and it's better answered by device_get_children(9). don't mix them up, i'm begging π
β RETURN VALUES β
- a zero return value means the device is not present in the system. it's gone, she left, no note π
- a non-zero return value means the device is present in the system β OR that the state of the device can't be determined. yeah, ambiguous queen. that's just how it is π
π EXAMPLES π
here's some example code. it only calls stop when the dc(4) device is actually present β iconic behavior, honestly:
device_t dev;
dc_softc *sc;
sc = device_get_softc(dev);
if (bus_child_present(dev))
dc_stop(sc);
π SEE ALSO π
π¦ AUTHORS π¦
this manual page was written by Warner Losh <imp@FreeBSD.org>. thank you warner, we appreciate you fr fr π
and that's the whole page bestie!! this one came from the Debian crew and it's dated March 27, 2003 β a true vintage baddie from the BUS_CHILD_PRESENT(9) archives. periodt. β¨ππ
π¦ 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) 2003 M. Warner Losh
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms