Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: Peter  Delgado <Peter.Delgado@sdrc.com>
Subject: Re: How can I find the real memory of a Digital Unix 3.x system
Date: 1995/09/29	[thread overview]
Message-ID: <44ha0o$i9@info1.sdrc.com> (raw)
In-Reply-To: 44fe6o$erk@newsbf02.news.aol.com

Here's code that will find the amount of RAM on a Digital UNIX
system.    I had to cast the integer address to a char to silence
the compiler warning.  Although the man page for getsysinfo indicates
a integer pointer is expected for the argument, the compiler insists
on a character pointer.  I didn't really have the time to investigate the 
discrepancy so it stayed.  Perhaps you might want to look at it!

Compile with cc -std1   or cc -migrate (to get better error messages)


#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <sys/sysinfo.h>
#include <machine/hal_sysinfo.h>

int main(int argc, char *argv[])
{
int     TotalMemory;


if (getsysinfo(GSI_PHYSMEM,(char *)&TotalMemory,(unsigned
                          long)(sizeof(int)),0,NULL) !=-1)
   {
   TotalMemory += 512;
   fprintf(stdout,"Total Memory = %d MB\n",TotalMemory/1024);
   exit(0);
   }
perror("PHYSMEM");
exit(1);
}

--Pete

-------------------------------------------------------------------------------
Pete Delgado                                      The opinions expressed are
Software Development/Support Engineer             my own and do not reflect
Product Installation                              the official opinions of
Structural Dynamics Research Corporation          SDRC.
2000 Eastman Drive                                
Milford, Ohio 45150
                                                  No user 
                                                  servicable parts inside!
e-mail:  Peter.Delgado@sdrc.com

-------------------------------------------------------------------------------




       reply	other threads:[~1995-09-29  4:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <44fe6o$erk@newsbf02.news.aol.com>
1995-09-29  4:00 ` Peter Delgado [this message]
1995-09-30  4:00 ` How can I find the real memory of a Digital Unix 3.x system Dan Pop
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