BUS_GET_CPUS(9)
π BUS_GET_CPUS π
okay bestie, gather round, because this is the manual page for BUS_GET_CPUS and bus_get_cpus from the Kernel Developer's Manual (section 9, we're fancy like that). It's the vibe where you ask a bus for a lil set of device-specific CPUs. Let's get into it β¨
πΈ NAME πΈ
BUS_GET_CPUS, bus_get_cpus β request a set of device-specific CPUs π§
β¨ SYNOPSIS β¨
#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 BUS_GET_CPUS() is the method that goes and queries the parent bus device for a set of CPUs that are specific to a device. Iconic behaviour, honestly.
The op argument is the one that tells it which set of CPUs you want to retrieve. If everything goes right, the set you asked for gets returned in cpuset. And the setsize argument? That's the size in bytes of the set you passed in via cpuset. No cap π
BUS_GET_CPUS() supports querying different types of CPU sets through that op argument. But here's the tea: not all set types are supported for every device π. If a set type isn't supported, BUS_GET_CPUS() just fails with EINVAL. So rude of it. The set types that are supported are:
LOCAL_CPUSβ the set of CPUs that are local to the device. So if a device is closer to a specific memory domain in a non-uniform memory architecture system (NUMA), this returns the set of CPUs in that memory domain. It's giving "geography matters" πΊοΈINTR_CPUSβ the preferred set of CPUs that this device should use for device interrupts. And bestie, listen: this set type must be supported by all bus drivers. Non-negotiable. periodt π
And the bus_get_cpus() function? She's just a simple wrapper around BUS_GET_CPUS(). Low-key a shortcut, high-key useful π«Ά
β RETURN VALUES β
Zero comes back on success π. Otherwise, an appropriate error is returned. That's it, that's the rule.
π SEE ALSO π
Go read them, iykyk π
π HISTORY π
The BUS_GET_CPUS() method and the bus_get_cpus() function first appeared in FreeBSD 11.0. A little origin story for you, bestie πΈ
and that's the whole page, fr fr π this one came from the Debian gang and it's dated March 1, 2016 β so go forth and query your CPU sets, main character πβ¨
π¦ 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) 2016 John H. Baldwin <jhb@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms