From: pim@cti-software.nl (Pim Zandbergen)
Subject: Re: Monitor 1.05.1 (was Re: Uptime problem in Aix 3.2)
Organization: CTI Software BV, The Hague, The Netherlands
Date: Fri, 14 Aug 92 21:16:41 GMT

jmaki@veivi.hut.fi (Jussi M{ki) writes:


>About that real memory value, I don't know the correct vay to do
>it in AIX3.?. My way has worked with 300 and 500 series. We don't have
>any RS/6000 model 220's here so perhaps somebody who has one could
>try to peek the way to look the real memory value. (Or IBM could
>tell us the correct way to do it?). If there would be an "AIX
>Internals manual" life would be lot easier with this.

I stole the real memory code from monitor for my own program
and found out it doesn't work on a 220 there as well.

So I had to do it the "official" way, which is probably through the ODM.
Link this program with -lodm.

#--------------------------------CUT HERE-------------------------------------
#! /bin/sh
#
# This is a shell archive.  Save this into a file, edit it
# and delete all lines above this comment.  Then give this
# file to sh by executing the command "sh file".  The files
# will be extracted into the current directory owned by
# you with default permissions.
#
# The files contained herein are:
#
# -rw-r--r--   1 pim      other       1449 Jun 15 14:45 getmem.c
#
echo 'x - getmem.c'
if test -f getmem.c; then echo 'shar: not overwriting getmem.c'; else
sed 's/^X//' << '________This_Is_The_END________' > getmem.c
X#include <odmi.h>
X#include <stdio.h>
X
X#define CuAt_Descs 7
X
Xstruct CuAt
X{
X	long _id;
X	long _reserved;
X	long _scratch;
X	char name[16];
X	char attribute[16];
X	char value[256];
X	char type[8];
X	char generic[8];
X	char rep[8];
X	short nls_index;
X};
X
Xextern struct Class CuAt_CLASS[];
X
Xstatic struct ClassElem CuAt_ClassElem[] = 
X{
X	{"name",      ODM_CHAR,   12,  16, NULL, NULL, 0, NULL , -1, 0},
X	{"attribute", ODM_CHAR,   28,  16, NULL, NULL, 0, NULL , -1, 0},
X	{"value",     ODM_CHAR,   44, 256, NULL, NULL, 0, NULL , -1, 0},
X	{"type",      ODM_CHAR,  300,   8, NULL, NULL, 0, NULL , -1, 0},
X	{"generic",   ODM_CHAR,  308,   8, NULL, NULL, 0, NULL , -1, 0},
X	{"rep",       ODM_CHAR,  316,   8, NULL, NULL, 0, NULL , -1, 0},
X	{"nls_index", ODM_SHORT, 324,   2, NULL, NULL, 0, NULL , -1, 0},
X};
X
Xstruct Class CuAt_CLASS[] = 
X{
X	ODMI_MAGIC, "/etc/objrepos/CuAt", sizeof(struct CuAt), 
X	CuAt_Descs, CuAt_ClassElem, NULL, FALSE, NULL, NULL,
X	0, 0, NULL, 0, "", 0, -ODMI_MAGIC
X};
X
Xmain()
X{
X	extern int	odmerrno;
X	char		*odmerrstr;
X	static char	*criteria = "name = 'sys0' and attribute = 'realmem'";
X	struct CuAt	returndata;
X
X	switch ((int) odm_get_first(CuAt_CLASS, criteria, &returndata))
X	{
X		case -1:
X		case  0:
X			odmerrstr = odm_err_msg(odmerrno, &odmerrstr) == 0 ? odmerrstr : "(null)";
X			fprintf(stderr, "odm_get_first() failed: %s\n", odmerrstr);
X			exit(1);
X	}
X
X	(void) odm_close_class(CuAt_CLASS);
X
X	printf("%d\n", atoi(returndata.value) * 1024);
X}
________This_Is_The_END________
if test `wc -c < getmem.c` -ne 1449; then
	echo 'shar: getmem.c was damaged during transit (should have been 1449 bytes)'
fi
fi		; : end of overwriting check
exit 0
-- 
Pim Zandbergen                      domain : pim@cti-software.nl
CTI Software BV                     uucp   : uunet!mcsun!sun4nl!ctisbv!pim
Laan Copes van Cattenburch 70       phone  : +31 70 3542302
2585 GD The Hague, The Netherlands  fax    : +31 70 3512837
Newsgroups: comp.unix.aix