BUS_CHILD_PRESENT(9)
πΈ NAME πΈ
okay bestie, welcome to bus_child_present(9) from the Kernel Developer's Manual β¨ the short version is: bus_child_present β ask the bus driver to see if this device is still really 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 π¦
The bus_child_present() function is like, βhey parent device driver of dev, can you check if the hardware represented by dev is still physically accessible right now?β π The whole notion of accessible changes from bus to bus, no cap, but generally: hardware that is not accessible cannot be accessed via the bus_space*() methods that would otherwise be used to access the device. π«Ά
Important vibe check: this does not ask the question βdoes this device have children?β β that one can better be answered by device_get_children(9). π
π RETURN VALUES π
- A zero return value means the device is not present in the system. π
- A non-zero return value means the device is present in the system, or that the state of the device cannot be determined. β¨
π EXAMPLES π
This is some example code. It only calls stop when the dc(4) device is actually present. π₯
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>. π
mwah π β this little page comes from Debian, dated March 27, 2003, and it signs off as BUS_CHILD_PRESENT(9). π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2003 M. Warner Losh <imp@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms