ITEM: FA4656L

How to get real memory from C program



Env
        AIX 4.1.4
        C for AIX 3.1

Problem:
        Customer would like a sample program that
        reports the amount of system real memory.
Action Taken:
        Researched Xmenu and was unable to locate
        sample.  Also infoexplorer did not show a quick
        answer.
Action Plan:
        Researching
Test Case:
        n/a


Response:

Response:

Action Taken:
  Emailed the following sample:

-----------------------cut here----------------------

/*
 * cc realmem.c -o realmem -lodm -lcfg
 */

\#include \
\#include \
\#include \
\#include \

int real_mem_k(void)
{        struct  CuAt *attobj;
        int     rc;

        /* machine type */
        attobj = (struct CuAt *)getattr("sys0","realmem",FALSE,&rc);

        if (attobj == (struct CuAt *) NULL) {
                return -1;
        }

        /* return machine real memory size in K */
        return( (int) strtol(attobj->value,(char **)NULL,0) );
}
main()
{  odm_initialize();
  printf("\\nSystem Real Memory - %dK \\n\\n",real_mem_k());
}--------------------------cut here----------------------------

Action Plan:
  cwca



Support Line: How to get real memory from C program ITEM: FA4656L
Dated: December 1997 Category: N/A
This HTML file was generated 99/06/24~13:30:15
Comments or suggestions? Contact us