[daip] install.pl - more reliable memory detection for solaris

Vincent.McIntyre at csiro.au Vincent.McIntyre at csiro.au
Tue May 2 19:53:01 EDT 2006


> Thanks.  There are not so many solaris machines so things do not get
> tested well anymore.  The actual memory in the machine is only one
> clue to the desired AP size.  Big ones like 80 Mbyte cost a lot in
> loading and swapping out and do not provide a big benefit for most
> applications.

oops, there was a problem with my call to grep. I should have quoted the
regex & egrepped, ie "/usr/bin/egrep -e '^Mem'" instead of "grep ^Mem".
However it's not actually needed so I dropped it.
Revised patch and sample prtdiag output attached.
This version actually works!

Kind regards
Vince
-------------- next part --------------
--- install.pl	2006-05-02 11:55:14.000000000 +1000
+++ 31DEC05/SYSTEM/UNIX/PERL/install.pl	2006-05-03 08:58:33.000000000 +1000
@@ -1891,10 +1891,10 @@
 }
 if (!$mem) {
                                         # Solaris
-    open(FOO, "dmesg 2>/dev/null | grep ^mem|");
+    open(FOO, "/usr/sbin/prtdiag 2>/dev/null |");
     while (<FOO>) {
-        if (/mem = ([0-9]+)K/) {
-            $mem = $1;
+        if (/memory size: *([0-9]+) *megabytes/i) {
+            $mem = $1 * 1024;
             last;
         }
     }
-------------- next part --------------
System Configuration:  Sun Microsystems  sun4u Sun Ultra 1 SBus (UltraSPARC 143MHz)
System clock frequency: 71 MHz
Memory size: 128 Megabytes

========================= CPUs =========================

                    Run   Ecache   CPU    CPU
Brd  CPU   Module   MHz     MB    Impl.   Mask
---  ---  -------  -----  ------  ------  ----
 0     0     0      143     0.5   US-I     2.2


========================= IO Cards =========================

     Bus   Freq
Brd  Type  MHz   Slot        Name                          Model
---  ----  ----  ----------  ----------------------------  --------------------
 0   SBus   25            2  cgsix                         SUNW,501-2325      
 0   SBus   25           14  espdma/esp (scsi)                                
 0   SBus   25           14  ledma/le (network)                               
 0   SBus   25           14  SUNW,bpp                                         
ERROR: Cannot determine PCI device type.


No failures found in System
===========================


More information about the Daip mailing list