radsetops, radaddset, radandset, radcopyset, radcountset,
raddelset, raddiffset, rademptyset, radfillset, radisemptyset,
radismember, radorset, radsetcreate, radsetdestroy,
radxorset - Perform operations on a set of Resource Affinity
Domains (libnuma library)
#include <radset.h>
int radaddset(
radset_t set,
radid_t radid ); int radandset(
radset_t set_src1,
radset_t set_src2,
radset_t set_dst ); int radcopyset(
radset_t set_src,
radset_t set_dst ); int radcountset(
radset_t set ); int raddelset(
radset_t set,
radid_t radid ); int raddiffset(
radset_t set_src1,
radset_t set_src2,
radset_t set_dst ); int rademptyset(
radset_t set ); int radfillset(
radset_t set ); int radisemptyset(
radset_t set ); int radismember(
radset_t set,
radid_t radid ); int radorset(
radset_t set_src1,
radset_t set_src2,
radset_t set_dst ); int radsetcreate(
radset_t *set ); int radsetdestroy(
radset_t *set ); int radxorset(
radset_t set_src1,
radset_t set_src2,
radset_t set_dst );
Identifies the RAD for which the function is requesting
information or on which the function operates. Specifies
or points to a set of Resource Affinity Domains (RADs) on
which the function operates. Specifies, depending on the
function, one of the following: A source RAD set that the
function copies to a destination RAD set One of two RAD
sets for which the function will find a logical difference
One of two RAD sets on which the function will perform a
logical AND, OR, or XOR operation Specifies the destination
RAD set where the function stores the results of the
logical operation it performs.
The radsetops primitives manipulate a specified set of
Resource Affinity Domains (RADs). These functions operate
on data objects (of type radset_t) that are created by
calls to radsetcreate().
The radsetcreate() function allocates, and sets to empty,
the specified RAD set.
The radsetdestroy() function releases the RAD set memory
allocated by radsetcreate().
The radfillset() function initializes the specified RAD
set, such that all RADs that are currently configured in
the caller's partition are included in that set.
The radcountset() function returns the number of members
in the specified RAD set.
The rademptyset() function reinitializes the specified RAD
set, such that no RADs are included in that set.
The radisemptyset() function tests whether the specified
RAD set is empty.
The radismember() function tests whether the specified RAD
is a member of the specified RAD set.
The radaddset() and raddelset() functions respectively add
or delete the specified RAD from the specified RAD set.
The raddiffset() function finds the logical difference
between the RAD sets specified by the arguments set_src1
and set_src2 and stores the result in the RAD set specified
by set_dst. (The result is made up of those members
included in set_src1 but not in set_src2.)
The radandset(), radorset(), and radxorset()functions
respectively perform a logical AND, OR, or XOR operation
on the RAD sets specified by the arguments set_src1 and
set_src2, storing the result in the RAD set specified by
set_dst.
The radisemptyset() and radismember() functions return the
following values: Success (True). Success (False). Failure.
In this case, errno is set to indicate the type of
error.
The remaining functions return the following values: Success.
Failure. In this case, errno is set to indicate the
type of error.
If the radcountset(), rademptyset(), radfillset(), radisemptyset(),
radorset(), radxorset(), radandset(), raddiffset(),
and radcopyset() functions fail, they set errno to
the following value for the specified condition specified:
The specified RAD set is invalid, possibly not created by
radsetcreate().
If the radsetcreate() and radsetdestroy() functions fail,
they set errno to one of the following values for the condition
specified: The set argument points to an invalid
address. (radsetcreate() only) No memory could be allocated
for the RAD set.
If the radaddset(), raddelset(), and radismember() functions
fail, they set errno to one of the following values
for the condition specified: The specified RAD set is
invalid, possibly not created by radsetcreate(). The
value of radid is an invalid or unsupported RAD identifier.
The following example demonstrates various operations on
RAD sets:
#include <radset.h>
int main() {
radset_t radset, radset2;
/* Create radsets - initialized as empty */
radsetcreate(&radset);
radsetcreate(&radset2);
/* demonstrate radset operations */
/* add rad 0 to radset */
if (radaddset(radset, 0) == -1) {
perror("radaddset");
return 0;
}
/* copy radset to radset2 */
if (radcopyset(radset, radset2) == -1) {
perror("radcopyset");
return 0;
}
/* add rad 1 to radset */
if (radaddset(radset, 1) == -1) {
perror("radaddset");
return 0;
}
/* store the difference of radset and radset2 in radset
*/
if (raddiffset(radset, radset2, radset) == -1) {
perror("raddiffset");
return 0;
}
/* Enumerate radset. */
while (1) {
radid_t id;
int flags = SET_CURSOR_CONSUME;
rad_cursor_t rad_cursor = SET_CURSOR_INIT;
id = rad_foreach(radset, flags, &rad_cursor);
if (id == RAD_NONE) {
printf("\n");
break;
} else {
printf("%3d ", id);
}
}
/* Destroy radset and radset2*/
radsetdestroy(&radset);
radsetdestroy(&radset2);
return 0; }
Functions: numa_intro(3), rad_foreach(3)
Files: numa_types(4)
radsetops(3)
[ Back ] |