NAME
Solaris::Kvm - Perl interface to Solaris Kernel Virtual Memory Access Library (libkvm)
SYNOPSIS
use Solaris::Kvm;
$handle = new Solaris::Kvm();
printf "value of maxusers %d\n", $handle->maxusers;
printf "size of maxusers variable %d\n", $handle->size('maxusers');
DESCRIPTION
Solaris::Kvm allows read access to Solaris kernel variables through the tied hash interface. By default, the module reads the /dev/ksyms namelist, but it is also possible to use an alternative namelist by passing its name to the module constructor:
$handle = new Solaris::Kvm("/my_namelist");
The value of a particular kernel variable can by looked up by simply retrieving the element from the hash using the name of the variable as a key:
printf "maxusers: %d\n", $handle->{maxusers};
Note, the value is automatically refreshed for every lookup - i.e. internally, the FETCH routine calls kvm_kread(). Variable value can also be retrieved using the subroutine/method syntax:
printf "maxusers: %d\n", $handle->maxusers;
although, it is slightly less efficient since such call is dispatched through the AUTOLOAD function. In addition to reading the values of kernel variables, the module is capable of providing the size of a variable (in bytes), its type (object, function, etc) as well as its bind (local, global, etc) and visibility (internal, protected, etc):
printf "maxusers size: %d\n", $handle->size('maxusers');
printf "maxusers type: %d\n", $handle->type('maxusers');
printf "maxusers bind: %d\n", $handle->bind('maxusers');
printf "maxusers visibility: %d\n", $handle->visibility('maxusers');
All these functions return standard ELF constants (STT_OBJECT, STT_HIDDEN, etc), defined in elf.h. The "write" function is disabled - those who wish to modify the values of kernel variables should really use /etc/system...;-).
EXPORT
STB_GLOBAL
STB_WEAK
STB_NUM
STT_NOTYPE
STT_OBJECT
STT_FUNC
STT_SECTION
STT_FILE
STT_COMMON
STT_TLS
STT_NUM
STV_DEFAULT
STV_INTERNAL
STV_HIDDEN
STV_PROTECTED
AUTHOR
Alexander Golomshtok<lt>golomshtok_alexander@jpmorgan.com<gt>