This question is mainly for the UNIX users out there...I need to write a program that will display all the configurable kernal parameters on a system, show their formula, and show their resolved value. what I have so far is below, but to explain it first, I run
kmtune -S /stand/system and throw it into an array to get all the parameters I need, and it displays the formula for them if any....the hexidecimal values are no problem, along with evaluating simple formulas...where I run into a snag is when a formula relys on the result of another parameter. I guess I dont understand enough about how to get around this to be able to explain it correctly, but if you know what kmtune's output looks like, you will see where I am running into a snag...here is what I got so far..
#!/usr/local/bin/perl
chomp(@datafile = `/usr/sbin/kmtune -S /stand/system`);
foreach (@datafile)
{
tr/[A-Z]/[a-z]/;
($key,$value) = split(/\s+/);
if ($key eq "Parameter" || $value eq "") { next; }
if (grep/^0x/i,$value) { $value = hex($value); }
$var{$key} = $value;
}
foreach $key(keys %var)
{
### Evaluating the hash variable generates errors on the ones that hav
+e varibales embedded in them.
#print "$key:", eval $var{$key}, "\n";
### This works, but doesnt resolve formulas in the variables.
print "$key:", $var{$key}, "\n";
}
Any help or ideas would be greatly appreciated...and if there is another way to get the formulas AND the end result, that would work, but I would prefer to find a nifty perly way to do it :)