1N/A# The contents of this file are subject to the terms of the 1N/A# Common Development and Distribution License (the "License"). 1N/A# You may not use this file except in compliance with the License. 1N/A# See the License for the specific language governing permissions 1N/A# and limitations under the License. 1N/A# When distributing Covered Code, include this CDDL HEADER in each 1N/A# If applicable, add the following below this CDDL HEADER, with the 1N/A# fields enclosed by brackets "[]" replaced with your own identifying 1N/A# information: Portions Copyright [yyyy] [name of copyright owner] 2N/A# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 1N/A# Lgrp.pm provides procedural and object-oriented interface to the Solaris 1N/A# liblgrp(3LIB) library. 1N/A# Define symbolic names for various subsets of export lists 1N/A# Define things that are ok ot export. 1N/A# _usage(): print error message and terminate the program. 1N/A Carp::
croak "Usage: Sun::Solaris::Lgrp::$msg";
1N/A# lgrp_isleaf($cookie, $lgrp) 1N/A# Returns T if lgrp is leaf, F otherwise. 1N/A scalar @_ ==
2 or _usage "lgrp_isleaf(cookie, lgrp)";
1N/A# lgrp_lgrps($cookie, [$lgrp]) 1N/A# Returns: list of lgrps in a subtree starting from $lgrp. 1N/A# If $root is not specified, use lgrp_root. 1N/A scalar @_ >
0 or _usage(
"lgrp_lgrps(cookie, [lgrp])");
1N/A # Concatenate root with subtrees for every children. Every subtree is 1N/A # obtained by calling lgrp_lgrps recursively with each of the children 1N/A# lgrp_leaves($cookie, [$lgrp]) 1N/A# Returns: list of leaves in the hierarchy starting from $lgrp. 1N/A# If $lgrp is not specified, use lgrp_root. 1N/A scalar @_ >
0 or _usage(
"lgrp_leaves(cookie, [lgrp])");
1N/A###################################################################### 1N/A# Object-Oriented interface. 1N/A###################################################################### 1N/A# cookie: extract cookie from the argument. 1N/A# If the argument is scalar, it is the cookie itself, otherwise it is the 1N/A# reference to the object and the cookie value is in $self->{COOKIE}. 1N/A# new: The object constructor 1N/A croak(
"lgrp_init: $!\n"),
return;
1N/A# DESTROY: the object destructor. 1N/A############################################################ 1N/A scalar @_ >
0 or _usage(
"lgrps(class, [lgrp])");
1N/A scalar @_ >
0 or _usage(
"leaves(class, [lgrp])");
1N/A scalar @_ >
0 or _usage(
"leaves(class, [version])");
1N/A scalar @_ ==
2 or _usage(
"children(class, lgrp)");
1N/A scalar @_ ==
2 or _usage(
"parents(class, lgrp)");
1N/A scalar @_ ==
4 or _usage(
"mem_size(class, lgrp, type, content)");
1N/A scalar @_ ==
3 or _usage(
"cpus(class, lgrp, content)");
1N/A scalar @_ ==
2 or _usage(
"isleaf(class, lgrp)");
1N/A scalar @_ ==
3 or _usage(
"resources(class, lgrp, resource)");
1N/A scalar @_ ==
3 or _usage(
"latency(class, from, to)");
1N/A# Methods that do not require cookie 1N/A scalar @_ ==
3 or _usage(
"home(class, idtype, id)");
1N/A scalar @_ ==
4 or _usage(
"affinity_get(class, idtype, id, lgrp)");
1N/A _usage(
"affinity_set(class, idtype, id, lgrp, affinity)");