BUS_GET_CPUS(9)
π BUS_GET_CPUS(9) π
okay so bestie, welcome to BUS_GET_CPUS(9) β that's the Kernel Developer's Manual section 9, aka the deep kernel lore zone. sit down, hydrate, and let me tell you about requesting a set of device-specific CPUs π«Ά
β¨ NAME β¨
BUS_GET_CPUS, bus_get_cpus β request a set of device-specific CPUs π»πΈ
π SYNOPSIS π
like, here's the part you actually copy-paste, no cap:
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/cpuset.h>
int
BUS_GET_CPUS(device_t dev, device_t child, enum cpu_sets op,
size_t setsize, cpuset_t *cpuset);
int
bus_get_cpus(device_t dev, enum cpu_sets op, size_t setsize,
cpuset_t *cpuset);
π¦ DESCRIPTION π¦
so the BUS_GET_CPUS() method is literally the main character here π β it goes and asks the parent bus device for a set of device-specific CPUs.
The op argument is the vibe check: it says which set of CPUs you want. If it all works out (success era β¨), the requested set of CPUs comes back to you in cpuset. And setsize is the size in bytes of the set you passed in cpuset β yes, bytes, keep track of your units bestie π
BUS_GET_CPUS() supports querying different types of CPU sets via the op argument. But ngl, not every set type is supported for every device π. If a set type isn't supported, BUS_GET_CPUS() fails with EINVAL. These set types are the supported ones, periodt:
LOCAL_CPUSβ the set of CPUs that are local to the device. If a device is closer to a specific memory domain in a non-uniform memory architecture system (NUMA), this will return the set of CPUs in that memory domain. proximity slay π§INTR_CPUSβ the preferred set of CPUs that this device should use for device interrupts. This set type must be supported by all bus drivers. no skipping this one π₯
The bus_get_cpus() function is a simple wrapper around BUS_GET_CPUS() β little icon, just handing things off π
β RETURN VALUES β
Zero is returned on success π otherwise an appropriate error is returned. that's it, that's the rule π
π SEE ALSO π
go read these next, iykyk:
π HISTORY π
The BUS_GET_CPUS() method and bus_get_cpus() function first appeared in FreeBSD 11.0. vintage β¨
and that's the whole page, bestie π this edition dropped from Debian and it's dated March 1, 2016 β mwah, go forth and query those CPU sets ππ¦π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2016 John H. Baldwin <jhb@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms