Using lgrp_resources()
The lgrp_resources()
function returns the number of resources contained
in the specified lgroup.
#include <sys/lgrp_user.h>
int lgrp_resources(lgrp_cookie_t cookie, lgrp_id_t lgrp, lgrp_id_t *lgrpids,
uint_t count, lgrp_rsrc_t type);The lgrp_resources()
function takes a cookie that represents a snapshot
of the lgroup hierarchy. This cookie is obtained from the
lgrp_init()
function. The lgrp_resources()
function returns the number of resources that are in the lgroup with the ID that is
specified by the value of the lgrp argument. The
lgrp_resources()
function represents the resources with a set
of lgroups that directly contain CPU or memory resources. The
lgrp_rsrc_t argument can have one of the following
values:
-
LGRP_RSRC_CPU -
The
lgrp_resources() function returns the number of CPU resources. -
LGRP_RSRC_MEM -
The
lgrp_resources() function returns the number of memory resources.
When the value passed in the lgrpids[] argument is not null and
the count argument is not zero, the
lgrp_resources()
function stores lgroup IDs in the
lgrpids[] array. The number of lgroup IDs stored in the array
can be up to the value of the count argument.
The lgrp_resources()
function returns
EINVAL when the specified cookie, lgroup ID, or type are
not valid. The lgrp_resources()
function returns
ESRCH when the function does not find the specified
lgroup ID.