Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: ripley@nostromo.in-berlin.de (Hans-Ch. Eckert)
Subject: Re: finding the amount of ram
Date: Fri, 04 Mar 1994 22:24:50 MET	[thread overview]
Message-ID: <H.ekE.19tZcEevkIA@nostromo.in-berlin.de> (raw)
In-Reply-To: anthony.761915288@aaii.oz.au

Although I'm about 10 days behind with this, I do have a solution for
this problem that is easy to use (unless you still have to install
perl, that is :-)

Greetings,
				Ripley

----8<---- /usr/local/bin/mem ----8<----
#!/usr/local/bin/perl
#
# Copyright 1993 by H.Eckert (ripley@nostromo.in-berlin.de)
# (Can you say ``GNU public licence'' ?  I knew you can...)
#

# If suid/sgid-scripts are available uncomment and remove the else-part
# You then need to set mem to sgid kmem...
#die "Permission denied on /dev/kmem.\n" unless (-r "/dev/kmem");
if (-r "/dev/kmem") {
	open (MEM,"/usr/etc/kvar -s physmem -rl -k /vmunix|")
		|| die "invokation of /usr/etc/kvar failed\n";
	while(<MEM>){
		($size) = /.* (.*)$/ ;
	}
	$memsize = (hex($size)*4);
}
else
{
	open (MEM, "/usr/etc/uerf -R -r 300|")
		|| die "invokation of /usr/etc/uerf failed\n";
	$i=0;$tmp="";
	while(($tmp=<MEM>) && ($i<30)){
		$size = $tmp if grep(/real mem/, $tmp);
		$i++;
	}
	($memsize) = $size =~ /.*=(.*)$/;
	$memsize /= 1024;
}

print ("This machine has ". $memsize . "KB of physical memory.\n");
-- 
Hans-Ch. Eckert,   Regensburger Str.2,  10777 Berlin,   Germany * ISO 8859-1
(intl) ripley@nostromo.in-berlin.de,                            *  � � �
Alternative: ripley@cs.tu-berlin.de                             *  aeoeuess
NeXTmail: hansagia@w271zrz.zrz.tu-berlin.de (and nowhere else!) *  � � �

      reply	other threads:[~1994-03-04 21:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-02-16 22:42 finding the amount of ram Wright, Thomas E.
1994-02-17 18:29 ` Alan Rollow - Dr. File System's Home for Wayward Inodes.
1994-02-22 11:08 ` anthony baxter
1994-03-04 21:24   ` Hans-Ch. Eckert [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox