rs_getrad Subroutine

Purpose

Returns a system resource allocation domain (RAD) contained in an input resource set.

Library

Standard C library (libc.a)

Syntax

#include <sys/rset.h>
int rs_getrad (rset, rad, sdl, index, flags)
rsethandle_t rset, rad;
unsigned int sdl;
unsigned int index;
unsigned int flags;

Description

The rs_getrad subroutine returns a system RAD at a specified system detail level and index that is contained in an input resource set. If only some of the resources in the specified system RAD are contained in the input resource set, only the resources in both the system RAD and the input resource set are returned.

The input resource set is specified by the rset parameter. The output system RAD is identified by the rad parameter.

The system RAD is specified by system detail level sdl and index number index. If only a portion of the specified RAD is contained in rset, only that portion is returned in rad.

The rset and rad parameters must be allocated (using the rs_alloc subroutine) prior to calling the rs_getrad subroutine.

Parameters

Item Description
rset Specifies a resource set handle for the input resource set.
rad Specifies a resource set handle to receive the desired system RAD (contained in the rset parameter).
sdl Specifies the system detail level of the desired system RAD.
index Specifies the index of the system RAD that should be returned from among those at the specified sdl. This parameter must belong to the [0, rs_numrads(rset, sdl, flags)- 1] interval.
flags The following flags (defined in rset.h) can be used to modify the default behavior of the rs_getrad subroutine. By default, the rs_getrad subroutine empties the resource set specified by rad before the specified RAD is retrieved.
  • RS_UNION: Instead of emptying rad before the specified RAD is retrieved, the RAD retrieved is added to the contents of rad. On completion, rad contains the union of its original contents and the specified RAD.
  • RS_EXCLUSION: Instead of emptying rad before the specified RAD is retrieved, the resources in the specified RAD that are also in rad are removed from rad. On return, rad contains all the resources it originally contained except those in the specified RAD.

Return Values

If successful, a value of 0 is returned. If unsuccessful, a value of -1 is returned and the errno global variable is set to indicate the error.

Error Codes

The rs_getrad subroutine is unsuccessful if one or more of the following are true:

Item Description
EINVAL One of the following is true:
  • The flags parameter contains an invalid value.
  • The sdl parameter is greater than the maximum system detail level.
  • The RAD specified by the index parameter does not exist at the system detail level specified by the sdl parameter.
EFAULT Invalid address.