DEVICE_PROBE_AND_ATTACH(9freebsd)

✨ DEVICE_PROBE_AND_ATTACH(9) ✨

okay bestie, this is a page from the Kernel Developer's Manual (section 9, the ✨deep lore✨ section), and it's all about a little function called device_probe_and_attach. it's giving "matchmaker for hardware" energy, and honestly? iconic. πŸ’…


🌸 NAME 🌸

device_probe_and_attach β€” initialise a device 🫢


πŸŽ€ SYNOPSIS πŸŽ€

#include <sys/param.h>
#include <sys/bus.h>

int
device_probe_and_attach(device_t dev);

πŸ’– DESCRIPTION πŸ’–

so this function gets called during autoconfiguration, which is basically the kernel's whole "getting ready" montage ✨ β€” its job is to initialise the devices in the system, one by one.

here's the vibe, step by step, no skipping:

  1. for each device, the DEVICE_PROBE(9) method of each suitable driver gets called πŸ”
  2. if a probe succeeds, a description of the device gets printed πŸ–¨οΈ (yes, the kernel is showing off, let it)
  3. then the DEVICE_ATTACH(9) method is called πŸͺ„
and one very important caveat bestie: if the device is disabled using device_disable(9), then it will not be probed. periodt. no probe for you, bestie. πŸ™ˆ

⭐ RETURN VALUES ⭐

  • 0 β€” success, slay, we love to see it πŸ‘‘
  • anything else β€” an appropriate error is returned 😭

🌈 SEE ALSO 🌈


πŸ¦‹ AUTHORS πŸ¦‹

this manual page was written by Doug Rabson. king behaviour, fr fr πŸ’œ


and that's the whole page bestie, we ate and left no crumbs πŸ’… β€” cute little sign-off time: this one came from Debian, dated June 16, 1998 (a vintage classic, lowkey older than us but still serving πŸŽ€), and it lives at DEVICE_PROBE_AND_ATTACH(9). mwah, go probe something ✨🫢

πŸ“¦ where this page comes from