rad_foreach(3)rad_foreach(3)NAMErad_foreach - Enumerates the members of a Resource Affinity Domain
#include <numa.h> rad_cursor_t cursor = SET_CURSOR_INIT;
unsigned int flags,
radset_cursor_t *cursor );
Specifies a set of Resource Affinity Domains (RADs) whose members are
to be enumerated. Specifies one or more flags that control the pro‐
cessing of RAD members in the set. The following symbolic values are
defined for flags: Initialize the cursor to the first member of the set
before scanning. Wrap around to the beginning of the RAD set when
scanning for members. Consume the set members; in other words, remove
members from the set as they are found. Specifies an opaque type that
records the position in a set for subsequent invocations of the
The rad_foreach() function scans the specified RAD set, starting at the
position saved in cursor, for members of the set and returns the first
member found. If the SET_CURSOR_FIRST flag is set, the cursor is ini‐
tialized to the beginning of the set before starting the scan. If no
members are found, the rad_foreach() function will return RAD_NONE.
If the SET_CURSOR_WRAP flag is set, the scan will wrap from the end of
the set to the beginning searching for a member to return. Otherwise,
a one-pass scan is performed, and when the end of the set is reached,
cursor()is left positioned at the end of the set. From then on, the
rad_foreach() function will continue to return RAD_NONE until cursor is
reinitialized, either by specifying the SET_CURSOR_FIRST flag or by
specifying the SET_CURSOR_WRAP flag.
If the SET_CURSOR_CONSUME flag is set, the member returned, if any,
will be removed from the set.
The cursor variable may be initialized to the value SET_CURSOR_INIT.
This is equivalent to setting SET_CURSOR_FIRST on the initial call to
Although DESCRIPTION discusses the “beginning” and “end” of the set,
and wrapping from the end to the beginning, RAD sets are conceptually
unordered. Thus, these end points are arbitrary points in the set that
exist to ensure that each member is returned only once per pass through
the set. Applications should not depend on a numeric ordering of the
returned member IDs.
This function returns either the next member in the RAD set, starting
at the position in cursor, or RAD_NONE (if there is no next member).
Execution of this function is always successful.
See EXAMPLES in radsetops(3) for a sample program that uses the
Functions: numa_intro(3), radsetops(3)