Content-type: text/html
$mcSysInfo = mcSysInfo->New;
# Optional: Specify pathname to sysinfo(1)
$mcSysInfo->Program($SysInfoPath);
# Optional: Use $InFile in place of sysinfo(1)
$mcSysInfo->InputFile($InFile);
# Optional: Limit data to class List
$mcSysInfo->Class(@List);
Please see mcsysinfoc(3) if a C API is required.
When mcSysInfo->Retrieve is called it runs the sysinfo(1) command by default to obtain the system configuration data. The data is parsed into perl(1) objects and made available as members of mcSysInfo (see below for details).
The following is a list of object members available for the mcSysInfo object:
The following mcSysInfo object members contain the system configuration data after mcSysInfo->Retrieve is called:
Member | Description | Returns |
Hostname | Host Name | Scalar |
HostAliases | Host Aliases | Array |
HostAddrs | Host Addresses | Array |
HostId | Host ID | Scalar |
Serial | Serial # | Scalar |
ManShort | Manufacturer (Short) | Scalar |
ManLong | Manufacturer (Long) | Scalar |
Man | Manufacturer | Scalar |
Model | Model | Scalar |
PhysMem | Physical Memory | Scalar |
VirtMem | Virtual Memory | Scalar |
RomVer | ROM Version | Scalar |
NumCpu | Number of CPU | Scalar |
CpuType | CPU Type | Scalar |
CpuSpeed | CPU Speed | Scalar |
AppArch | App Architecture | Scalar |
KernArch | Kernel Architecture | Scalar |
OSname | OS Name | Scalar |
OSver | OS Version | Scalar |
OSdist | OS Distribution | Scalar |
KernVer | Kernel Version | Scalar |
BootTime | Boot Time | Scalar |
CurrentTime | Current Time | Scalar |
LibcName | Libc Name | Scalar |
LibcVer | Libc Version | Scalar |
A special device entry with a key of TOTAL DISK contains the total amount of disk space on the system.
Member | Description | Returns |
Name | Name of device | Scalar |
Driver | Driver name | Scalar |
Aliases | Aliases | Array |
AltName | AKA Name | Scalar |
Files | Files | Array |
Type | Type | Scalar |
ClassType | Class Type | Scalar |
Vendor | Manufacturer | Scalar |
Model | Model | Scalar |
ModelDesc | Model Description | Scalar |
Part | Part # | Scalar |
Serial | Serial # | Scalar |
Ident | Identifier | Scalar |
Revision | Revision | Scalar |
Unit | Unit | Scalar |
NodeID | Node ID | Scalar |
DescList | List of misc descriptions | Array |
DevSpec | Device type specific data | varies |
Slaves | List of child devices | Array |
Next | Next peer device | Scalar |
Member | Description | Returns |
Man | Manufacturer | Scalar |
Model | Model | Scalar |
Arch | Architecture | Scalar |
ArchVer | Architecture Version | Scalar |
Serial | Serial # | Scalar |
BitSize | Bit Size | Scalar |
Speed | Clock Speed | Scalar |
L1iCacheSize | L1 Instruction Cache Size | Scalar |
L1iAssoc | L1 Instruction Associativety | Scalar |
L1iLines | L1 Instruction Lines | Scalar |
L1iLineSize | L1 Instruction Line Size | Scalar |
InstTLB | Instruction TLB | Scalar |
InstTLBAssoc | Instruction TLB Associativety | Scalar |
L1dCacheSize | L1 Data Cache Size | Scalar |
L1dAssoc | L1 Data Associativety | Scalar |
L1dLines | L1 Data Lines | Scalar |
L1dLineSize | L1 Data Line Size | Scalar |
DataTLB | Data TLB | Scalar |
DataTLBAssoc | Data TLB Associativety | Scalar |
L2CacheSize | L2 Cache Size | Scalar |
L2Assoc | L2 Associativety | Scalar |
L2Lines | L2 Lines | Scalar |
L2LineSize | L2 Line Size | Scalar |
HasFPU | Has FPU | Scalar |
Stepping | Stepping | Scalar |
Member | Description | Returns |
Type | NIC Address Type | Scalar |
HostAddr | NIC Host Address | Scalar |
HostName | NIC Host Name | Scalar |
MACaddr | NIC MAC Current Address | Scalar |
MACname | NIC MAC Current Name | Scalar |
FacMACaddr | NIC MAC Factory Address | Scalar |
FacMACname | NIC MAC Factory Name | Scalar |
NetAddr | NIC Network Address | Scalar |
NetName | NIC Network Name | Scalar |
Member | Description | Returns |
Name | Name of package | Scalar |
EntryType | Entry Type | Scalar |
Version | Version | Scalar |
Revision | Revision | Scalar |
Description | Description | Scalar |
DescVerbose | Description (Verbose) | Scalar |
URL | URL | Scalar |
License | License | Scalar |
Copyright | Copyright | Scalar |
Category | Category | Scalar |
SubCategory | Sub-Category | Scalar |
OSname | Requires OS Name | Scalar |
OSversion | Requires OS Version | Scalar |
Arch | Requires Architecture | Scalar |
ISArch | Requires Inst Set Arch | Scalar |
InstDate | Installation Date | Scalar |
BuildDate | Build Date | Scalar |
ProdStamp | Production Stamp | Scalar |
BaseDir | Base Directory | Scalar |
DiskUsage | Disk Usage | Scalar |
FileList | File List | Array |
VendorName | Vendor Name | Scalar |
VendorEmail | Vendor Email | Scalar |
VendorPhone | Vendor Phone # | Scalar |
VendorStock | Vendor Stock # | Scalar |
DescList | List of misc description data | Array |
Master | Name of master package | Scalar |
MasterVer | Version of master | Scalar |
MasterRev | Revisionof master | Scalar |
Slaves | List of child packages | Array |
Next | Next peer package | Scalar |
Member | Description | Returns |
Name | Partition Name | Scalar |
DevName | Device Name | Scalar |
DevPath | Device Path | Scalar |
DevPathRaw | Device Path Raw | Scalar |
BaseName | Base Name | Scalar |
Slice | Slice | Scalar |
Num | Partition # | Scalar |
Type | Type | Scalar |
TypeDesc | Type Description | Scalar |
TypeNum | Type Number | Scalar |
UsageStatus | Usage Status | Scalar |
MntName | Mount Name | Scalar |
MntOpts | Mount Options | Array |
Size | Size (MB) | Scalar |
AmtUsed | Amount Used (MB) | Scalar |
SecSize | Sector Size (bytes) | Scalar |
StartSect | Starting Sector | Scalar |
EndSect | Ending Sector | Scalar |
NumSect | Number of Sectors | Scalar |
Member | Description | Returns |
Name | Variable name | Scalar |
Desc | Description of entry | Scalar |
Value | Value of this variable | Scalar |
For detailed examples please take a look at /usr/local/sysinfo/lib/ui/uiGUI.pm This is the main model which implements the GUI for sysinfo(1) which utilizes the mcSysInfo interface.
The following example displays the hostname and system model:
The following example displays a list of all device names and their model (if known):
use lib ('/usr/local/sysinfo/lib/mcSysInfo'); use mcSysInfo; $si = mcSysInfo->New; # Only retrieve the info we need $si->Class('Hardware'); $si->Retrieve(); foreach my $Key (keys %{ $si->Hardware->Entries }) { my $di = $si->Hardware->Entries->{$Key}; printf ("Device %s is a %s\n", $Key, $di->Model); }