Main index | Section 9 | Options |
#include <sys/_cpuset.h>
#include <sys/cpuset.h>
The CPUSET_T_INITIALIZER() macro allows one to initialize a cpuset_t with a compile time literal value.
The CPUSET_FSET() macro defines a compile time literal, usable by CPUSET_T_INITIALIZER(), representing a full cpuset (all CPUs present). For examples of CPUSET_T_INITIALIZER() and CPUSET_FSET() usage, see the CPUSET_T_INITIALIZER EXAMPLE section.
The CPU_CLR() macro removes CPU cpu_idx from the cpuset pointed to by cpuset. The CPU_CLR_ATOMIC() macro is identical, but the bit representing the CPU is cleared with atomic machine instructions.
The CPU_COPY() macro copies the contents of the cpuset from to the cpuset to. CPU_COPY_STORE_REL() is similar, but copies component machine words from from and writes them to to with atomic store with release semantics. (That is, if to is composed of multiple machine words, CPU_COPY_STORE_REL() performs multiple individually atomic operations.)
The CPU_SET() macro adds CPU cpu_idx to the cpuset pointed to by cpuset, if it is not already present. The CPU_SET_ATOMIC() macro is identical, but the bit representing the CPU is set with atomic machine instructions. The CPU_SET_ATOMIC_ACQ() macro sets the bit representing the CPU with atomic acquire semantics.
The CPU_ZERO() macro removes all CPUs from cpuset.
The CPU_FILL() macro adds all CPUs to cpuset.
The CPU_SETOF() macro removes all CPUs in cpuset before adding only CPU cpu_idx.
The CPU_EMPTY() macro returns true if cpuset is empty.
The CPU_ISFULLSET() macro returns true if cpuset is full (the set of all CPUs).
The CPU_FFS() macro returns the 1-index of the first (lowest) CPU in cpuset, or zero if cpuset is empty. Like with ffs(3), to use the non-zero result of CPU_FFS() as a cpu_idx index parameter to any other cpuset(9) macro, you must subtract one from the result.
The CPU_COUNT() macro returns the total number of CPUs in cpuset.
The CPU_SUBSET() macro returns true if needle is a subset of haystack.
The CPU_OVERLAP() macro returns true if cpuset1 and cpuset2 have any common CPUs. (That is, if cpuset1 AND cpuset2 is not the empty set.)
The CPU_CMP() macro returns true if cpuset1 is NOT equal to cpuset2.
The CPU_OR() macro adds CPUs present in src to dst. (It is the cpuset(9) equivalent of the scalar: dst |= src, .) CPU_OR_ATOMIC() is similar, but sets the bits representing CPUs in the component machine words in dst with atomic machine instructions. (That is, if dst is composed of multiple machine words, CPU_OR_ATOMIC() performs multiple individually atomic operations.)
The CPU_AND() macro removes CPUs absent from src from dst. (It is the cpuset(9) equivalent of the scalar: dst &= src, .) CPU_AND_ATOMIC() is similar, with the same atomic semantics as CPU_OR_ATOMIC().
The CPU_NAND() macro removes CPUs in src from dst. (It is the cpuset(9) equivalent of the scalar: dst &= ~, src, .)
cpuset_t myset;/* Initialize myset to filled (all CPUs) */ myset = CPUSET_T_INITIALIZER(CPUSET_FSET);
/* Initialize myset to only the lowest CPU */ myset = CPUSET_T_INITIALIZER(0x1);
This manual page first appeared in FreeBSD 11.0 .
CPUSET (9) | September 23, 2022 |
Main index | Section 9 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
“ | To err is human...to really foul up requires the root password. | ” |