JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
man pages section 3: Extended Library Functions, Volume 3     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

Extended Library Functions, Volume 3

endprojent(3PROJECT)

Exacct(3PERL)

Exacct::Catalog(3PERL)

Exacct::File(3PERL)

Exacct::Object(3PERL)

Exacct::Object::Group(3PERL)

Exacct::Object::Item(3PERL)

fgetprojent(3PROJECT)

getdefaultproj(3PROJECT)

getprojbyid(3PROJECT)

getprojbyname(3PROJECT)

getprojent(3PROJECT)

getprojidbyname(3PROJECT)

inproj(3PROJECT)

Kstat(3PERL)

Lgrp(3PERL)

libpicl(3PICL)

libpicltree(3PICLTREE)

nv_alloc_fini(3NVPAIR)

nv_alloc_init(3NVPAIR)

nv_alloc_reset(3NVPAIR)

nvlist_add_boolean(3NVPAIR)

nvlist_add_boolean_array(3NVPAIR)

nvlist_add_boolean_value(3NVPAIR)

nvlist_add_byte(3NVPAIR)

nvlist_add_byte_array(3NVPAIR)

nvlist_add_double(3NVPAIR)

nvlist_add_int16(3NVPAIR)

nvlist_add_int16_array(3NVPAIR)

nvlist_add_int32(3NVPAIR)

nvlist_add_int32_array(3NVPAIR)

nvlist_add_int64(3NVPAIR)

nvlist_add_int64_array(3NVPAIR)

nvlist_add_int8(3NVPAIR)

nvlist_add_int8_array(3NVPAIR)

nvlist_add_nvlist(3NVPAIR)

nvlist_add_nvlist_array(3NVPAIR)

nvlist_add_nvpair(3NVPAIR)

nvlist_add_string(3NVPAIR)

nvlist_add_string_array(3NVPAIR)

nvlist_add_uint16(3NVPAIR)

nvlist_add_uint16_array(3NVPAIR)

nvlist_add_uint32(3NVPAIR)

nvlist_add_uint32_array(3NVPAIR)

nvlist_add_uint64(3NVPAIR)

nvlist_add_uint64_array(3NVPAIR)

nvlist_add_uint8(3NVPAIR)

nvlist_add_uint8_array(3NVPAIR)

nvlist_alloc(3NVPAIR)

nvlist_dup(3NVPAIR)

nvlist_exists(3NVPAIR)

nvlist_flag(3NVPAIR)

nvlist_free(3NVPAIR)

nvlist_lookup_boolean(3NVPAIR)

nvlist_lookup_boolean_array(3NVPAIR)

nvlist_lookup_boolean_value(3NVPAIR)

nvlist_lookup_byte(3NVPAIR)

nvlist_lookup_byte_array(3NVPAIR)

nvlist_lookup_double(3NVPAIR)

nvlist_lookup_int16(3NVPAIR)

nvlist_lookup_int16_array(3NVPAIR)

nvlist_lookup_int32(3NVPAIR)

nvlist_lookup_int32_array(3NVPAIR)

nvlist_lookup_int64(3NVPAIR)

nvlist_lookup_int64_array(3NVPAIR)

nvlist_lookup_int8(3NVPAIR)

nvlist_lookup_int8_array(3NVPAIR)

nvlist_lookup_nv_alloc(3NVPAIR)

nvlist_lookup_nvlist(3NVPAIR)

nvlist_lookup_nvlist_array(3NVPAIR)

nvlist_lookup_nvpair(3NVPAIR)

nvlist_lookup_pairs(3NVPAIR)

nvlist_lookup_string(3NVPAIR)

nvlist_lookup_string_array(3NVPAIR)

nvlist_lookup_uint16(3NVPAIR)

nvlist_lookup_uint16_array(3NVPAIR)

nvlist_lookup_uint32(3NVPAIR)

nvlist_lookup_uint32_array(3NVPAIR)

nvlist_lookup_uint64(3NVPAIR)

nvlist_lookup_uint64_array(3NVPAIR)

nvlist_lookup_uint8(3NVPAIR)

nvlist_lookup_uint8_array(3NVPAIR)

nvlist_merge(3NVPAIR)

nvlist_next_nvpair(3NVPAIR)

nvlist_pack(3NVPAIR)

nvlist_remove(3NVPAIR)

nvlist_remove_all(3NVPAIR)

nvlist_size(3NVPAIR)

nvlist_unpack(3NVPAIR)

nvlist_xalloc(3NVPAIR)

nvlist_xdup(3NVPAIR)

nvlist_xpack(3NVPAIR)

nvlist_xunpack(3NVPAIR)

nvpair_name(3NVPAIR)

nvpair_type(3NVPAIR)

nvpair_value_boolean_array(3NVPAIR)

nvpair_value_boolean_value(3NVPAIR)

nvpair_value_byte(3NVPAIR)

nvpair_value_byte_array(3NVPAIR)

nvpair_value_double(3NVPAIR)

nvpair_value_int16(3NVPAIR)

nvpair_value_int16_array(3NVPAIR)

nvpair_value_int32(3NVPAIR)

nvpair_value_int32_array(3NVPAIR)

nvpair_value_int64(3NVPAIR)

nvpair_value_int64_array(3NVPAIR)

nvpair_value_int8(3NVPAIR)

nvpair_value_int8_array(3NVPAIR)

nvpair_value_nvlist(3NVPAIR)

nvpair_value_nvlist_array(3NVPAIR)

nvpair_value_string(3NVPAIR)

nvpair_value_string_array(3NVPAIR)

nvpair_value_uint16(3NVPAIR)

nvpair_value_uint16_array(3NVPAIR)

nvpair_value_uint32(3NVPAIR)

nvpair_value_uint32_array(3NVPAIR)

nvpair_value_uint64(3NVPAIR)

nvpair_value_uint64_array(3NVPAIR)

nvpair_value_uint8(3NVPAIR)

nvpair_value_uint8_array(3NVPAIR)

pam(3PAM)

pam_acct_mgmt(3PAM)

pam_authenticate(3PAM)

pam_chauthtok(3PAM)

pam_close_session(3PAM)

pam_end(3PAM)

pam_eval(3PAM)

pam_get_data(3PAM)

pam_getenv(3PAM)

pam_getenvlist(3PAM)

pam_get_item(3PAM)

pam_get_user(3PAM)

pam_open_session(3PAM)

pam_putenv(3PAM)

pam_setcred(3PAM)

pam_set_data(3PAM)

pam_set_item(3PAM)

pam_sm(3PAM)

pam_sm_acct_mgmt(3PAM)

pam_sm_authenticate(3PAM)

pam_sm_chauthtok(3PAM)

pam_sm_close_session(3PAM)

pam_sm_open_session(3PAM)

pam_sm_setcred(3PAM)

pam_start(3PAM)

pam_strerror(3PAM)

papiAttributeListAddBoolean(3PAPI)

papiAttributeListAddCollection(3PAPI)

papiAttributeListAddDatetime(3PAPI)

papiAttributeListAddInteger(3PAPI)

papiAttributeListAddMetadata(3PAPI)

papiAttributeListAddRange(3PAPI)

papiAttributeListAddResolution(3PAPI)

papiAttributeListAddString(3PAPI)

papiAttributeListAddValue(3PAPI)

papiAttributeListDelete(3PAPI)

papiAttributeListFind(3PAPI)

papiAttributeListFree(3PAPI)

papiAttributeListFromString(3PAPI)

papiAttributeListGetBoolean(3PAPI)

papiAttributeListGetCollection(3PAPI)

papiAttributeListGetDatetime(3PAPI)

papiAttributeListGetInteger(3PAPI)

papiAttributeListGetMetadata(3PAPI)

papiAttributeListGetNext(3PAPI)

papiAttributeListGetRange(3PAPI)

papiAttributeListGetResolution(3PAPI)

papiAttributeListGetString(3PAPI)

papiAttributeListGetValue(3PAPI)

papiAttributeListToString(3PAPI)

papiJobCancel(3PAPI)

papiJobFree(3PAPI)

papiJobGetAttributeList(3PAPI)

papiJobGetId(3PAPI)

papiJobGetJobTicket(3PAPI)

papiJobGetPrinterName(3PAPI)

papiJobHold(3PAPI)

papiJobListFree(3PAPI)

papiJobModify(3PAPI)

papiJobMove(3PAPI)

papiJobPromote(3PAPI)

papiJobQuery(3PAPI)

papiJobRelease(3PAPI)

papiJobRestart(3PAPI)

papiJobStreamClose(3PAPI)

papiJobStreamOpen(3PAPI)

papiJobStreamWrite(3PAPI)

papiJobSubmit(3PAPI)

papiJobSubmitByReference(3PAPI)

papiJobValidate(3PAPI)

papiLibrarySupportedCall(3PAPI)

papiLibrarySupportedCalls(3PAPI)

papiPrinterAdd(3PAPI)

papiPrinterDisable(3PAPI)

papiPrinterEnable(3PAPI)

papiPrinterFree(3PAPI)

papiPrinterGetAttributeList(3PAPI)

papiPrinterListFree(3PAPI)

papiPrinterListJobs(3PAPI)

papiPrinterModify(3PAPI)

papiPrinterPause(3PAPI)

papiPrinterPurgeJobs(3PAPI)

papiPrinterQuery(3PAPI)

papiPrinterRemove(3PAPI)

papiPrinterResume(3PAPI)

papiPrintersList(3PAPI)

papiServiceCreate(3PAPI)

papiServiceDestroy(3PAPI)

papiServiceGetAppData(3PAPI)

papiServiceGetAttributeList(3PAPI)

papiServiceGetEncryption(3PAPI)

papiServiceGetPassword(3PAPI)

papiServiceGetServiceName(3PAPI)

papiServiceGetStatusMessage(3PAPI)

papiServiceGetUserName(3PAPI)

papiServiceSetAppData(3PAPI)

papiServiceSetAuthCB(3PAPI)

papiServiceSetEncryption(3PAPI)

papiServiceSetPassword(3PAPI)

papiServiceSetUserName(3PAPI)

papiStatusString(3PAPI)

picld_log(3PICLTREE)

picld_plugin_register(3PICLTREE)

picl_find_node(3PICL)

picl_get_first_prop(3PICL)

picl_get_frutree_parent(3PICL)

picl_get_next_by_col(3PICL)

picl_get_next_by_row(3PICL)

picl_get_next_prop(3PICL)

picl_get_node_by_path(3PICL)

picl_get_prop_by_name(3PICL)

picl_get_propinfo(3PICL)

picl_get_propinfo_by_name(3PICL)

picl_get_propval(3PICL)

picl_get_propval_by_name(3PICL)

picl_get_root(3PICL)

picl_initialize(3PICL)

picl_set_propval(3PICL)

picl_set_propval_by_name(3PICL)

picl_shutdown(3PICL)

picl_strerror(3PICL)

picl_wait(3PICL)

picl_walk_tree_by_class(3PICL)

pool_associate(3POOL)

pool_component_info(3POOL)

pool_component_to_elem(3POOL)

pool_conf_alloc(3POOL)

pool_conf_close(3POOL)

pool_conf_commit(3POOL)

pool_conf_export(3POOL)

pool_conf_free(3POOL)

pool_conf_info(3POOL)

pool_conf_location(3POOL)

pool_conf_open(3POOL)

pool_conf_remove(3POOL)

pool_conf_rollback(3POOL)

pool_conf_status(3POOL)

pool_conf_to_elem(3POOL)

pool_conf_update(3POOL)

pool_conf_validate(3POOL)

pool_create(3POOL)

pool_destroy(3POOL)

pool_dissociate(3POOL)

pool_dynamic_location(3POOL)

pool_error(3POOL)

pool_get_binding(3POOL)

pool_get_owning_resource(3POOL)

pool_get_pool(3POOL)

pool_get_property(3POOL)

pool_get_resource(3POOL)

pool_get_resource_binding(3POOL)

pool_get_status(3POOL)

pool_info(3POOL)

pool_put_property(3POOL)

pool_query_components(3POOL)

pool_query_pool_resources(3POOL)

pool_query_pools(3POOL)

pool_query_resource_components(3POOL)

pool_query_resources(3POOL)

pool_resource_create(3POOL)

pool_resource_destroy(3POOL)

pool_resource_info(3POOL)

pool_resource_to_elem(3POOL)

pool_resource_transfer(3POOL)

pool_resource_type_list(3POOL)

pool_resource_xtransfer(3POOL)

pool_rm_property(3POOL)

pool_set_binding(3POOL)

pool_set_status(3POOL)

pool_static_location(3POOL)

pool_strerror(3POOL)

pool_to_elem(3POOL)

pool_value_alloc(3POOL)

pool_value_free(3POOL)

pool_value_get_bool(3POOL)

pool_value_get_double(3POOL)

pool_value_get_int64(3POOL)

pool_value_get_name(3POOL)

pool_value_get_string(3POOL)

pool_value_get_type(3POOL)

pool_value_get_uint64(3POOL)

pool_value_set_bool(3POOL)

pool_value_set_double(3POOL)

pool_value_set_int64(3POOL)

pool_value_set_name(3POOL)

pool_value_set_string(3POOL)

pool_value_set_uint64(3POOL)

pool_version(3POOL)

pool_walk_components(3POOL)

pool_walk_pools(3POOL)

pool_walk_properties(3POOL)

pool_walk_resources(3POOL)

Privilege(3PERL)

proc_service(3PROC)

Project(3PERL)

project_walk(3PROJECT)

ps_kill(3PROC)

ps_lcontinue(3PROC)

ps_lgetcxregs(3PROC)

ps_lgetcxregsize(3PROC)

ps_lgetfpregs(3PROC)

ps_lgetregs(3PROC)

ps_lgetxregs(3PROC)

ps_lgetxregsize(3PROC)

ps_lrolltoaddr(3PROC)

ps_lsetcxregs(3PROC)

ps_lsetfpregs(3PROC)

ps_lsetregs(3PROC)

ps_lsetxregs(3PROC)

ps_lstop(3PROC)

ps_pcontinue(3PROC)

ps_pdread(3PROC)

ps_pdwrite(3PROC)

ps_pglobal_lookup(3PROC)

ps_pglobal_sym(3PROC)

ps_pread(3PROC)

ps_pstop(3PROC)

ps_ptread(3PROC)

ps_ptwrite(3PROC)

ps_pwrite(3PROC)

ptree_add_node(3PICLTREE)

ptree_add_prop(3PICLTREE)

ptree_add_row_to_table(3PICLTREE)

ptree_create_and_add_node(3PICLTREE)

ptree_create_and_add_prop(3PICLTREE)

ptree_create_node(3PICLTREE)

ptree_create_prop(3PICLTREE)

ptree_create_table(3PICLTREE)

ptree_delete_node(3PICLTREE)

ptree_delete_prop(3PICLTREE)

ptree_destroy_node(3PICLTREE)

ptree_destroy_prop(3PICLTREE)

ptree_find_node(3PICLTREE)

ptree_get_first_prop(3PICLTREE)

ptree_get_frutree_parent(3PICLTREE)

ptree_get_next_by_col(3PICLTREE)

ptree_get_next_by_row(3PICLTREE)

ptree_get_next_prop(3PICLTREE)

ptree_get_node_by_path(3PICLTREE)

ptree_get_prop_by_name(3PICLTREE)

ptree_get_propinfo(3PICLTREE)

ptree_get_propinfo_by_name(3PICLTREE)

ptree_get_propval(3PICLTREE)

ptree_get_propval_by_name(3PICLTREE)

ptree_get_root(3PICLTREE)

ptree_init_propinfo(3PICLTREE)

ptree_post_event(3PICLTREE)

ptree_register_handler(3PICLTREE)

ptree_unregister_handler(3PICLTREE)

ptree_update_propval(3PICLTREE)

ptree_update_propval_by_name(3PICLTREE)

ptree_walk_tree_by_class(3PICLTREE)

reparse_add(3REPARSE)

reparse_create(3REPARSE)

reparse_delete(3REPARSE)

reparse_deref(3REPARSE)

reparse_free(3REPARSE)

reparse_init(3REPARSE)

reparse_parse(3REPARSE)

reparse_remove(3REPARSE)

reparse_unparse(3REPARSE)

reparse_validate(3REPARSE)

rp_plugin_init(3REPARSE)

setproject(3PROJECT)

setprojent(3PROJECT)

Task(3PERL)

Ucred(3PERL)

Lgrp

- Perl interface to Solaris liblgrp library

Synopsis

use Sun::Solaris::Lgrp qw(:ALL);

# initialize lgroup interface
my $cookie = lgrp_init(LGRP_VIEW_OS | LGRP_VIEW_CALLER);
my $l = Sun::Solaris::Lgrp->new(LGRP_VIEW_OS | 
     LGRP_VIEW_CALLER);

my $version = lgrp_version(LGRP_VER_CURRENT | LGRP_VER_NONE);
$version = $l->version(LGRP_VER_CURRENT | LGRP_VER_NONE);

$home = lgrp_home(P_PID, P_MYID);
$home = l->home(P_PID, P_MYID);

lgrp_affinity_set(P_PID, $pid, $lgrp,
      LGRP_AFF_STRONG | LGRP_AFF_WEAK | LGRP_AFF_NONE);
$l->affinity_set(P_PID, $pid, $lgrp,
      LGRP_AFF_STRONG | LGRP_AFF_WEAK | LGRP_AFF_NONE);

my $affinity = lgrp_affinity_get(P_PID, $pid, $lgrp);
$affinity = $l->affinity_get(P_PID, $pid, $lgrp);

my $nlgrps = lgrp_nlgrps($cookie);
$nlgrps = $l->nlgrps();

my $root = lgrp_root($cookie);
$root = l->root();

$latency = lgrp_latency($lgrp1, $lgrp2);
$latency = $l->latency($lgrp1, $lgrp2);

my @children = lgrp_children($cookie, $lgrp);
@children = l->children($lgrp);

my @parents = lgrp_parents($cookie, $lgrp);
@parents = l->parents($lgrp);

my @lgrps = lgrp_lgrps($cookie);
@lgrps = l->lgrps();

@lgrps = lgrp_lgrps($cookie, $lgrp);
@lgrps = l->lgrps($lgrp);

my @leaves = lgrp_leaves($cookie);
@leaves = l->leaves();

my $is_leaf = lgrp_isleaf($cookie, $lgrp);
$is_leaf = $l->is_leaf($lgrp);

my @cpus = lgrp_cpus($cookie, $lgrp,
     LGRP_CONTENT_HIERARCHY | LGRP_CONTENT_DIRECT);
@cpus = l->cpus($lgrp, LGRP_CONTENT_HIERARCHY | 
     LGRP_CONTENT_DIRECT);

my $memsize = lgrp_mem_size($cookie, $lgrp,
      LGRP_MEM_SZ_INSTALLED | LGRP_MEM_SZ_FREE,
      LGRP_CONTENT_HIERARCHY | LGRP_CONTENT_DIRECT);
$memsize = l->mem_size($lgrp,
      LGRP_MEM_SZ_INSTALLED | LGRP_MEM_SZ_FREE,
      LGRP_CONTENT_HIERARCHY | LGRP_CONTENT_DIRECT);

my $is_stale = lgrp_cookie_stale($cookie);
$stale = l->stale();

lgrp_fini($cookie);

# The following is available for API version greater than 1:
my @lgrps = lgrp_resources($cookie, $lgrp, LGRP_RSRC_CPU);

# Get latencies from cookie
$latency = lgrp_latency_cookie($cookie, $from, $to);

Description

This module provides access to the liblgrp(3LIB) library and to various constants and functions defined in <sys/lgrp_sys.h>. It provides both the procedural and object interface to the library. The procedural interface requires (in most cases) passing around a transparent cookie. The object interface hides all the cookie manipulations from the user.

Functions returning a scalar value indicate an error by returning undef. The caller can examine the $! variable to get the error value.

Functions returning a list value return the number of elements in the list when called in scalar context. In the event of error, the empty list is returned in the array context and undef is returned in the scalar context.

Constants

The constants are exported with :CONSTANTS or :ALL tags:

use Sun::Solaris::Lgrp ':ALL';

or

use Sun::Solaris::Lgrp ':CONSTANTS';

The following constants are available for use in Perl programs:

LGRP_NONE
LGRP_VER_CURRENT
LGRP_VER_NONE
LGRP_VIEW_CALLER
LGRP_VIEW_OS
LGRP_AFF_NONE
LGRP_AFF_STRONG
LGRP_AFF_WEAK
LGRP_CONTENT_DIRECT
LGRP_CONTENT_HIERARCHY
LGRP_MEM_SZ_FREE
LGRP_MEM_SZ_FREE
LGRP_RSRC_CPU (1)
LGRP_RSRC_MEM (1)
LGRP_CONTENT_ALL (1)
LGRP_LAT_CPU_TO_MEM (1)
P_PID
P_LWPID
P_MYID

(1) Available for versions of the liblgrp(3LIB) API greater than 1.

Functions

A detailed description of each function follows. Since this module is intended to provide a Perl interface to the functions in liblgrp(3LIB), a very short description is given for the corresponding functions in this module and a reference is given to the complete description in the liblgrp manual pages. Any differences or additional functionality in the Perl module are highlighted and fully documented here.

lgrp_init([LGRP_VIEW_CALLER | LGRP_VIEW_OS])

This function initializes the lgroup interface and takes a snapshot of the lgroup hierarchy with the given view. Given the view, lgrp_init() returns a cookie representing this snapshot of the lgroup hierarchy. This cookie should be used with other routines in the lgroup interface needing the lgroup hierarchy. The lgrp_fini() function should be called with the cookie when it is no longer needed. Unlike lgrp_init(3LGRP), LGRP_VIEW_OS is assumed as the default if no view is provided.

Upon successful completion, lgrp_init() returns a cookie. Otherwise it returns undef and sets $! to indicate the error.

See lgrp_init(3LGRP) for more information.

lgrp_fini($cookie)

This function takes a cookie, frees the snapshot of the lgroup hierarchy created by lgrp_init(), and cleans up anything else set up by lgrp_init(). After this function is called, the cookie returned by the lgroup interface might no longer be valid and should not be used.

Upon successful completion, 1 is returned. Otherwise, undef is returned and $! is set to indicate the error.

See lgrp_fini(3LGRP) for more information.

lgrp_view($cookie)

This function takes a cookie representing the snapshot of the lgroup hierarchy and returns the snapshot's view of the lgroup hierarchy.

If the given view is LGRP_VIEW_CALLER, the snapshot contains only the resources that are available to the caller (such as those with respect to processor sets). When the view is LGRP_VIEW_OS, the snapshot contains what is available to the operating system.

Upon succesful completion, the function returns the view for the snapshot of the lgroup hierarchy represented by the given cookie. Otherwise, undef is returned and $! is set to indicate the error.

See lgrp_view(3LGRP) for more information.

lgrp_home($idtype, $id)

This function returns the home lgroup for the given process or thread. The $idtype argument should be P_PID to specify a process and the $id argument should be its process ID. Otherwise, the $idtype argument should be P_LWPID to specify a thread and the $id argument should be its LWP ID. The value P_MYID can be used for the $id argument to specify the current process or thread.

Upon successful completion, lgrp_home() returns the ID of the home lgroup of the specified process or thread. Otherwise, undef is returned and $! is set to indicate the error.

See lgrp_home(3LGRP) for more information.

lgrp_cookie_stale($cookie)

Upon successful completion, this function returns whether the cookie is stale. Otherwise, it returns undef and sets $! to indicate the error.

The lgrp_cookie_stale() function will fail with EINVAL if the cookie is not valid.

See lgrp_cookie_stale(3LGRP) for more information.

lgrp_cpus($cookie, $lgrp, $context)

This function takes a cookie representing a snapshot of the lgroup hierarchy and returns the list of CPUs in the lgroup specified by $lgrp. The $context argument should be set to one of the following values to specify whether the direct contents or everything in this lgroup including its children should be returned:

LGRP_CONTENT_HIERARCHY

everything within this hierarchy

LGRP_CONTENT_DIRECT

directly contained in lgroup

When called in scalar context, lgrp_cpus() function returns the number of CPUs contained in the specified lgroup.

In the event of error, undef is returned in scalar context and $! is set to indicate the error. In list context, the empty list is returned and $! is set.

See lgrp_cpus(3LGRP) for more information.

lgrp_children($cookie, $lgrp)

This function takes a cookie representing a snapshot of the lgroup hierarchy and returns the list of lgroups that are children of the specified lgroup.

When called in scalar context, lgrp_children() returns the number of children lgroups for the specified lgroup.

In the event of error, undef or empty list is returned and $! is set to indicate the error.

See lgrp_children(3LGRP) for more information.

lgrp_parents($cookie, $lgrp)

This function takes a cookie representing a snapshot of the lgroup hierarchy and returns the list of parents of the specified lgroup.

When called in scalar context, lgrp_parents() returns the number of parent lgroups for the specified lgroup.

In the event of error, undef or an empty list is returned and $! is set to indicate the error.

See lgrp_parents(3LGRP) for more information.

lgrp_nlgrps($cookie)

This function takes a cookie representing a snapshot of the lgroup hierarchy. It returns the number of lgroups in the hierarchy, where the number is always at least one.

In the event of error, undef is returned and $! is set to EINVAL, indicating that the cookie is not valid.

See lgrp_nlgrps(3LGRP) for more information.

lgrp_root($cookie)

This function returns the root lgroup ID.

In the event of error, undef is returned and $! is set to EINVAL, indicatng that the cookie is not valid.

See lgrp_root(3LGRP) for more information.

lgrp_mem_size($cookie, $lgrp, $type, $content)

This function takes a cookie representing a snapshot of the lgroup hierarchy. The function returns the memory size of the given lgroup in bytes. The $type argument should be set to one of the following values:

LGRP_MEM_SZ_FREE

free memory

LGRP_MEM_SZ_INSTALLED

installed memory

The $content argument should be set to one of the following values to specify whether the direct contents or everything in this lgroup including its children should be returned:

LGRP_CONTENT_HIERARCHY

Return everything within this hierarchy.

LGRP_CONTENT_DIRECT

Return that which is directly contained in this lgroup.

The total sizes include all the memory in the lgroup including its children, while the others reflect only the memory contained directly in the given lgroup.

Upon successful completion, the size in bytes is returned. Otherwise, undef is returned and $! is set to indicate the error.

See lgrp_mem_size(3LGRP) for more information.

lgrp_version([$version])

This function takes an interface version number, $version, as an argument and returns an lgroup interface version. The $version argument should be the value of LGRP_VER_CURRENT or LGRP_VER_NONE to find out the current lgroup interface version on the running system.

If $version is still supported by the implementation, then lgrp_version() returns the requested version. If LGRP_VER_NONE is returned, the implementation cannot support the requested version.

If $version is LGRP_VER_NONE, lgrp_version() returns the current version of the library.

The following example tests whether the version of the interface used by the caller is supported:

lgrp_version(LGRP_VER_CURRENT) == LGRP_VER_CURRENT or
    die("Built with unsupported lgroup interface");

See lgrp_version(3LGRP) for more information.

lgrp_affinity_set($idtype, $id, $lgrp, $affinity)

This function sets the affinity that the LWP or set of LWPs specified by $idtype and $id have for the given lgroup. The lgroup affinity can be set to LGRP_AFF_STRONG, LGRP_AFF_WEAK, or LGRP_AFF_NONE.

If the $idtype is P_PID, the affinity is retrieved for one of the LWPs in the process or set for all the LWPs of the process with process ID (PID) $id. The affinity is retrieved or set for the LWP of the current process with LWP ID $id if $idtype is P_LWPID. If $id is P_MYID, then the current LWP or process is specified.

There are different levels of affinity that can be specified by a thread for a particuliar lgroup. The levels of affinity are the following from strongest to weakest:

LGRP_AFF_STRONG

strong affinity

LGRP_AFF_WEAK

weak affinity

LGRP_AFF_NONE

no affinity

Upon successful completion, lgrp_affinity_set() returns 1. Otherwise, it returns undef and set $! to indicate the error.

See lgrp_affinity_set(3LGRP) for more information.

lgrp_affinity_get($idtype, $id, $lgrp)

This function returns the affinity that the LWP has to a given lgroup.

See lgrp_affinity_get(3LGRP) for more information.

lgrp_latency_cookie($cookie, $from, $to, [$between=LGRP_LAT_CPU_TO_MEM])

This function takes a cookie representing a snapshot of the lgroup hierarchy and returns the latency value between a hardware resource in the $from lgroup to a hardware resource in the $to lgroup. If $from is the same lgroup as $to, the latency value within that lgroup is returned.

The optional $between argument should be set to LGRP_LAT_CPU_TO_MEM to specify between which hardware resources the latency should be measured. The only valid value is LGRP_LAT_CPU_TO_MEM, which represents latency from CPU to memory.

Upon successful completion, lgrp_latency_cookie() return 1. Otherwise, it returns undef and set $! to indicate the error. For LGRP API version 1, the lgrp_latency_cookie() is an alias for lgrp_latency.()

See lgrp_latency_cookie(3LGRP) for more information.

lgrp_latency($from, $to)

This function is similiar to the lgrp_latency_cookie() function, but returns the latency between the given lgroups at the given instant in time. Since lgroups can be freed and reallocated, this function might not be able to provide a consistent answer across calls. For that reason, lgrp_latency_cookie() should be used in its place.

See lgrp_latency(3LGRP) for more information.

lgrp_resources($cookie, $lgrp, $type)

This function returns the list of lgroups directly containing resources of the specified type. The resources are represented by a set of lgroups in which each lgroup directly contains CPU and/or memory resources.

The type can be specified as:

LGRP_RSRC_CPU

CPU resources

LGRP_RSRC_MEM

memory resources

In the event of error, undef or an empty list is returned and $! is set to indicate the error.

This function is available only for API version 2 and returns undef or an empty list for API version 1 and sets $! to EINVAL.

See lgrp_resources(3LGRP) for more information.

lgrp_lgrps($cookie, [$lgrp])

This function returns a list of all lgroups in a hierarchy starting from $lgrp. If $lgrp is not specified, uses the value of lgrp_root($cookie). This function returns the empty list on failure.

When called in scalar context, this function returns the total number of lgroups in the system.

lgrp_leaves($cookie, [$lgrp])

This function returns a list of all leaf lgroups in a hierarchy starting from $lgrp. If $lgrp is not specified, this function uses the value of lgrp_root($cookie). It returns undef or an empty list on failure.

When called in scalar context, this function returns the total number of leaf lgroups in the system.

lgrp_isleaf($cookie, $lgrp)

This function returns True if $lgrp is a leaf (has no children). Otherwise it returns False.

Object methods

new([$view])

This method creates a new Sun::Solaris::Lgrp object. An optional argument is passed to the lgrp_init() function. By default this method uses LGRP_VIEW_OS.

cookie()

This method returns a transparent cookie that can be passed to functions accepting the cookie.

version([$version])

Without the argument, this method returns the current version of the liblgrp(3LIB) library. This method is a wrapper for lgrp_version() with LGRP_VER_NONE as the default version argument.

stale()

This method returns T if the lgroup information in the object is stale and F otherwise. It is a wrapper for lgrp_cookie_stale().

view()

This method returns the snapshot's view of the lgroup hierarchy. It is a wrapper for lgrp_view().

root()

This method returns the root lgroup. It is a wrapper for lgrp_root().

children($lgrp)

This method returns the list of lgroups that are children of the specified lgroup. It is a wrapper for lgrp_children().

parents($lgrp)

This method returns the list of lgroups that are parents of the specified lgroup. It is a wrapper for lgrp_parents().

nlgrps()

This method returns the number of lgroups in the hierarchy. It is a wrapper for lgrp_nlgrps().

mem_size($lgrp, $type, $content)

This method returns the memory size of the given lgroup in bytes. It is a wrapper for lgrp_mem_size().

cpus($lgrp, $context)

This method returns the list of CPUs in the lgroup specified by $lgrp. It is a wrapper for lgrp_cpus().

resources($lgrp, $type)

This method returns the list of lgroups directly containing resources of the specified type. It is a wrapper for lgrp_resources().

home($idtype, $id)

This method returns the home lgroup for the given process or thread. It is a wrapper for lgrp_home().

affinity_get($idtype, $id, $lgrp)

This method returns the affinity that the LWP has to a given lgrp. It is a wrapper for lgrp_affinity_get().

affinity_set($idtype, $id, $lgrp, $affinity)

This method sets the affinity that the LWP or set of LWPs specified by $idtype and $id have for the given lgroup. It is a wrapper for lgrp_affinity_set.

lgrps([$lgrp])

This method returns list of all lgroups in a hierarchy starting from $lgrp or the lgrp_root() if $lgrp is not specified. It is a wrapper for lgrp_lgrps().

leaves([$lgrp])

This method returns a list of all leaf lgroups in a hierarchy starting from $lgrp. If $lgrp is not specified, this method uses the value of lgrp_root(). It is a wrapper for lgrp_leaves().

isleaf($lgrp)

This method returns True if $lgrp is leaf (has no children) and False otherwise. It is a wrapper for lgrp_isleaf().

latency($from, $to)

This method returns the latency value between a hardware resource in the $from lgroup to a hardware resource in the $to lgroup. It uses lgrp_latency() for version 1 of liblgrp and lgrp_latency_cookie() for newer versions.

Exports

By default nothing is exported from this module. The following tags can be used to selectively import constants and functions defined in this module:

:LGRP_CONSTANTS

LGRP_AFF_NONE, LGRP_AFF_STRONG, LGRP_AFF_WEAK, LGRP_CONTENT_DIRECT, LGRP_CONTENT_HIERARCHY, LGRP_MEM_SZ_FREE, LGRP_MEM_SZ_INSTALLED, LGRP_VER_CURRENT, LGRP_VER_NONE, LGRP_VIEW_CALLER, LGRP_VIEW_OS, LGRP_NONE, LGRP_RSRC_CPU, LGRP_RSRC_MEM, LGRP_CONTENT_ALL, LGRP_LAT_CPU_TO_MEM

:PROC_CONSTANTS

P_PID, P_LWPID, P_MYID

:CONSTANTS

:LGRP_CONSTANTS, :PROC_CONSTANTS

:FUNCTIONS

lgrp_affinity_get(), lgrp_affinity_set(), lgrp_children(), lgrp_cookie_stale(), lgrp_cpus(), lgrp_fini(), lgrp_home(), lgrp_init(), lgrp_latency(), lgrp_latency_cookie(), lgrp_mem_size(), lgrp_nlgrps(), lgrp_parents(), lgrp_root(), lgrp_version(), lgrp_view(), lgrp_resources(), lgrp_lgrps(), lgrp_leaves(), lgrp_isleaf()

:ALL

:CONSTANTS, :FUNCTIONS

Error values

The functions in this module return undef or an empty list when an underlying library function fails. The $! is set to provide more information values for the error. The following error codes are possible:

EINVAL

The value supplied is not valid.

ENOMEM

There was not enough system memory to complete an operation.

EPERM

The effective user of the calling process does not have appropriate privileges, and its real or effective user ID does not match the real or effective user ID of one of the threads.

ESRCH

The specified process or thread was not found.

Difference in the API versions

The liblgrp(3LIB) library is versioned. The exact version that was used to compile a module is available through the lgrp_version() function.

Version 2 of the lgrp_user API introduced the following constants and functions not present in version 1:

LGRP_RSRC_CPU constant
LGRP_RSRC_MEM constant
LGRP_CONTENT_ALL constant
LGRP_LAT_CPU_TO_MEM constant
lgrp_resources() function
lgrp_latency_cookie() function

The LGRP_RSRC_CPU and LGRP_RSRC_MEM constants are not defined for version 1. The lgrp_resources() function is defined for version 1 but always returns an empty list. The lgrp_latency_cookie() function is an alias for lgrp_latency() for version 1.

Attributes

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
runtime/perl-510/module/sun-solaris
Interface Stability
Uncommitted

See Also

lgrp_affinity_get(3LGRP), lgrp_affinity_set(3LGRP), lgrp_children(3LGRP), lgrp_cookie_stale(3LGRP), lgrp_cpus(3LGRP), lgrp_fini(3LGRP), lgrp_home(3LGRP), lgrp_init(3LGRP), lgrp_latency(3LGRP), lgrp_latency_cookie(3LGRP), lgrp_mem_size(3LGRP), lgrp_nlgrps(3LGRP), lgrp_parents(3LGRP), lgrp_resources(3LGRP), lgrp_root(3LGRP), lgrp_version(3LGRP), lgrp_view(3LGRP), liblgrp(3LIB), attributes(5)