home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / aix / 8826 < prev    next >
Encoding:
Text File  |  1992-08-14  |  3.7 KB  |  113 lines

  1. Newsgroups: comp.unix.aix
  2. Path: sparky!uunet!mcsun!sun4nl!ctisbv!pim
  3. From: pim@cti-software.nl (Pim Zandbergen)
  4. Subject: Re: Monitor 1.05.1 (was Re: Uptime problem in Aix 3.2)
  5. Message-ID: <1992Aug14.211641.25274@cti-software.nl>
  6. Organization: CTI Software BV, The Hague, The Netherlands
  7. References: <1992Aug11.170432.420@mintaka.lcs.mit.edu>     <1992Aug11.212853.25897@newssrv.edvz.univie.ac.at>     <1992Aug12.072921.8037@aragorn.unibe.ch> <JMAKI.92Aug12160253@veivi.hut.fi>
  8. Date: Fri, 14 Aug 92 21:16:41 GMT
  9. Lines: 102
  10.  
  11. jmaki@veivi.hut.fi (Jussi M{ki) writes:
  12.  
  13.  
  14. >About that real memory value, I don't know the correct vay to do
  15. >it in AIX3.?. My way has worked with 300 and 500 series. We don't have
  16. >any RS/6000 model 220's here so perhaps somebody who has one could
  17. >try to peek the way to look the real memory value. (Or IBM could
  18. >tell us the correct way to do it?). If there would be an "AIX
  19. >Internals manual" life would be lot easier with this.
  20.  
  21. I stole the real memory code from monitor for my own program
  22. and found out it doesn't work on a 220 there as well.
  23.  
  24. So I had to do it the "official" way, which is probably through the ODM.
  25. Link this program with -lodm.
  26.  
  27. #--------------------------------CUT HERE-------------------------------------
  28. #! /bin/sh
  29. #
  30. # This is a shell archive.  Save this into a file, edit it
  31. # and delete all lines above this comment.  Then give this
  32. # file to sh by executing the command "sh file".  The files
  33. # will be extracted into the current directory owned by
  34. # you with default permissions.
  35. #
  36. # The files contained herein are:
  37. #
  38. # -rw-r--r--   1 pim      other       1449 Jun 15 14:45 getmem.c
  39. #
  40. echo 'x - getmem.c'
  41. if test -f getmem.c; then echo 'shar: not overwriting getmem.c'; else
  42. sed 's/^X//' << '________This_Is_The_END________' > getmem.c
  43. X#include <odmi.h>
  44. X#include <stdio.h>
  45. X
  46. X#define CuAt_Descs 7
  47. X
  48. Xstruct CuAt
  49. X{
  50. X    long _id;
  51. X    long _reserved;
  52. X    long _scratch;
  53. X    char name[16];
  54. X    char attribute[16];
  55. X    char value[256];
  56. X    char type[8];
  57. X    char generic[8];
  58. X    char rep[8];
  59. X    short nls_index;
  60. X};
  61. X
  62. Xextern struct Class CuAt_CLASS[];
  63. X
  64. Xstatic struct ClassElem CuAt_ClassElem[] = 
  65. X{
  66. X    {"name",      ODM_CHAR,   12,  16, NULL, NULL, 0, NULL , -1, 0},
  67. X    {"attribute", ODM_CHAR,   28,  16, NULL, NULL, 0, NULL , -1, 0},
  68. X    {"value",     ODM_CHAR,   44, 256, NULL, NULL, 0, NULL , -1, 0},
  69. X    {"type",      ODM_CHAR,  300,   8, NULL, NULL, 0, NULL , -1, 0},
  70. X    {"generic",   ODM_CHAR,  308,   8, NULL, NULL, 0, NULL , -1, 0},
  71. X    {"rep",       ODM_CHAR,  316,   8, NULL, NULL, 0, NULL , -1, 0},
  72. X    {"nls_index", ODM_SHORT, 324,   2, NULL, NULL, 0, NULL , -1, 0},
  73. X};
  74. X
  75. Xstruct Class CuAt_CLASS[] = 
  76. X{
  77. X    ODMI_MAGIC, "/etc/objrepos/CuAt", sizeof(struct CuAt), 
  78. X    CuAt_Descs, CuAt_ClassElem, NULL, FALSE, NULL, NULL,
  79. X    0, 0, NULL, 0, "", 0, -ODMI_MAGIC
  80. X};
  81. X
  82. Xmain()
  83. X{
  84. X    extern int    odmerrno;
  85. X    char        *odmerrstr;
  86. X    static char    *criteria = "name = 'sys0' and attribute = 'realmem'";
  87. X    struct CuAt    returndata;
  88. X
  89. X    switch ((int) odm_get_first(CuAt_CLASS, criteria, &returndata))
  90. X    {
  91. X        case -1:
  92. X        case  0:
  93. X            odmerrstr = odm_err_msg(odmerrno, &odmerrstr) == 0 ? odmerrstr : "(null)";
  94. X            fprintf(stderr, "odm_get_first() failed: %s\n", odmerrstr);
  95. X            exit(1);
  96. X    }
  97. X
  98. X    (void) odm_close_class(CuAt_CLASS);
  99. X
  100. X    printf("%d\n", atoi(returndata.value) * 1024);
  101. X}
  102. ________This_Is_The_END________
  103. if test `wc -c < getmem.c` -ne 1449; then
  104.     echo 'shar: getmem.c was damaged during transit (should have been 1449 bytes)'
  105. fi
  106. fi        ; : end of overwriting check
  107. exit 0
  108. -- 
  109. Pim Zandbergen                      domain : pim@cti-software.nl
  110. CTI Software BV                     uucp   : uunet!mcsun!sun4nl!ctisbv!pim
  111. Laan Copes van Cattenburch 70       phone  : +31 70 3542302
  112. 2585 GD The Hague, The Netherlands  fax    : +31 70 3512837
  113.