rad_foreach(3)rad_foreach(3)NAMErad_foreach - Enumerates the members of a Resource Affinity Domain
(libnuma library)
SYNOPSIS
#include <numa.h> rad_cursor_t cursor = SET_CURSOR_INIT;
int rad_foreach(
radset_t radset,
unsigned int flags,
radset_cursor_t *cursor );
PARAMETERS
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
rad_foreach() function.
DESCRIPTION
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
rad_foreach().
NOTES
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.
RETURN VALUES
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.
ERRORS
None.
EXAMPLES
See EXAMPLES in radsetops(3) for a sample program that uses the
rad_foreach() function.
SEE ALSO
Functions: numa_intro(3), radsetops(3)
Files: numa_types(4)rad_foreach(3)