1 : This shell script snoops around to find the maximum amount of available
2 : user memory. These variables need to be set only if there is no
3 : /usr/adm/messages. KMEM, UNIX, and CLICKSIZE can be set on the command
4 : line, if desired, e.g. UNIX=/unix
5 KMEM=/dev/kmem # User needs read access to KMEM
7 # VAX CLICKSIZE=512, UNIX=/vmunix
8 # PDP-11 CLICKSIZE=64, UNIX=/unix
9 # CADLINC 68000 CLICKSIZE=4096, UNIX=/unix
10 # Perkin-Elmer 3205 CLICKSIZE=4096, UNIX=/edition7
11 # Perkin-Elmer all others, CLICKSIZE=2048, UNIX=/edition7
16 if test -r /usr/adm/messages # probably the most transportable
18 SIZE=`grep avail /usr/adm/messages | sed -n '$s/.*[ ]//p'`
21 if test 0$SIZE -le 0 # no SIZE in /usr/adm/messages
23 if test -r $KMEM # Readable KMEM
27 : User must have specified it already.
31 CLICKSIZE=512 # Probably VAX
32 elif test -r /edition7
35 CLICKSIZE=2048 # Perkin-Elmer: change to 4096 on a 3205
38 UNIX=/unix # Could be anything
42 SIZE=`echo maxmem/D | adb $UNIX $KMEM | sed -n '$s/.*[ ]//p'`
45 SIZE=`echo physmem/D | adb $UNIX $KMEM | sed -n '$s/.*[ ]//p'`
47 SIZE=`expr 0$SIZE '*' $CLICKSIZE`
53 /vmunix) # Assume 4.2bsd: check for resource limits
54 MAXSIZE=`csh -c limit | awk 'BEGIN { MAXSIZE = 1000000 }
55 /datasize|memoryuse/ && NF == 3 { if ($2 < MAXSIZE) MAXSIZE = $2 }
56 END { print MAXSIZE * 1000 }'`
57 if test $MAXSIZE -lt $SIZE