[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Kernel and Subsystems, Volume 1

krs_op Subroutine

Purpose

Performs a set of operations on one or two resource sets.

Syntax

#include <sys/rset.h>
int krs_op (command, rset1, rset2, flags, id)
unsigned int command;
rsethandle_t rset1, rset2;
unsigned int flags;
unsigned int id;

Description

The krs_op subroutine performs the operation specified by the command parameter on resource set rset1, or both resource sets rset1 and rset2.

Parameters

command Specifies the operation to apply to the resource sets identified by rset1 and rset2. One of the following values, defined in rset.h, can be used:
  • RS_UNION: The resources contained in either rset1 or rset2 are stored in rset2.
  • RS_INTERSECTION: The resources that are contained in both rset1 and rset2 are stored in rset2.
  • RS_EXCLUSION: The resources in rset1 that are also in rset2 are removed from rset2. On completion, rset2 contains all the resources that were contained in rset2 but were not contained in rset1.
  • RS_COPY: All resources in rset1 whose type is flags are stored in rset2. If rset1 contains no resources of this type, rset2 will be empty. The previous content of rset2 is lost, while the content of rset1 is unchanged.
  • RS_ISEMPTY: Test if resource set rset1 is empty.
  • RS_ISEQUAL: Test if resource sets rset1 and rset2 are equal.
  • RS_ISCONTAINED: Test if all resources in resource set rset1 are also contained in resource set rset2.
  • RS_TESTRESOURCE: Test if the resource whose type is flags and index is id is contained in resource set rset1.
  • RS_ADDRESOURCE: Add the resource whose type is flags and index is id to resource set rset1.
  • RS_DELRESOURCE: Delete the resource whose type is flags and index is id from resource set rset1.
rset1 Specifies the resource set handle for the first of the resource sets involved in the command operation.
rset2 Specifies the resource set handle for the second of the resource sets involved in the command operation. This resource set is also used, on return, to store the result of the operation, and its previous content is lost. The rset2 parameter is ignored on the RS_ISEMPTY, RS_TESTRESOURCE, RS_ADDRESOURCE, and RS_DELRESOURCE commands.
flags When combined with the RS_COPY command, the flags parameter specifies the type of the resources that will be copied from rset1 to rset2. This parameter is constructed by logically ORing one or more of the following values, defined in rset.h:
  • R_PROCS: processors
  • R_MEMPS: memory pools
  • R_ALL_RESOURCES: processors and memory pools

If none of the above are specified for flags, R_ALL_RESOURCES is assumed.

id On the RS_TESTRESOURCE, RS_ADDRESOURCE, and RS_DELRESOURCE commands, the id parameter specifies the index of the resource to be tested, added, or deleted. This parameter is ignored on the other commands.

Return Values

0 Successful completion. The tested condition is not met for the RS_ISEMPTY, RS_ISEQUAL, RS_ISCONTAINED, and RS_TESTRESOURCE commands.
1 Successful completion. The tested condition is met for the RS_ISEMPTY, RS_ISEQUAL, RS_ISCONTAINED, and RS_TESTRESOURCE commands.
-1 Unsuccessful completion. One or more of the following are true:
  • rset1 identifies an invalid resource set.
  • rset2 identifies an invalid resource set.
  • command identifies an invalid operation.
  • flags identifies an invalid resource type.
  • id specifies a resource index that is too large.
  • Invalid address.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]