BUS_CHILD_PRESENT(9)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

🌸 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