[Xymon] hpux-meminfo.c patch

Jason Fredricksen jasonajfredricksen at gmail.com
Tue Feb 22 15:15:14 CET 2011


This patch for hpux-meminfo.c may help due to  11iv3 page sizes 4096 ,8192
,16384 ,65536. from: man 5 base_pagesize
running xymon 4.2.3 l

diff then the modified source:

15d14
< #include <unistd.h>
24,25d22
<       unsigned long pgsizecnf;
<       int d=0;
31,48c28,29
<       pgsizecnf = sysconf(_SC_PAGE_SIZE);
<               switch(pgsizecnf) {
<                      case 4096:
<                          d = 256;
<                          break;
<                      case 8192:
<                          d = 128;
<                          break;
<                      case 16384:
<                          d = 64;
<                          break;
<                      case 65536:
<                          d = 16;
<                          break;
<                      default:
<                      exit (1);
<                                }
<       printf("Total:%ld\n", sbuf.physical_memory/d);
---
>
>       printf("Total:%ld\n", sbuf.physical_memory/256);
50a32
>
/*----------------------------------------------------------------------------*/
/* Hobbit memory information tool for HP-UX.
 */
/* This tool retrieves information about the total and free RAM.
 */
/*
 */
/* Copyright (C) 2005-2006 Henrik Storner <henrik at hswn.dk>
 */
/*
 */
/* This program is released under the GNU General Public License (GPL),
  */
/* version 2. See the file "COPYING" for details.
  */
/*
 */
/*----------------------------------------------------------------------------*/

static char rcsid[] = "$Id: hpux-meminfo.c,v 1.4 2006-05-03 21:12:33 henrik
Exp $";

#include <sys/pstat.h>
#include <unistd.h>
#include <stdio.h>

main(int argc, char *argv[])
{
       struct pst_static sbuf;
       struct pst_dynamic dbuf;
       unsigned long pgsizekb;
       unsigned long kpages;
       unsigned long pgsizecnf;
       int d=0;

       pstat_getstatic(&sbuf, sizeof(sbuf), 1, 0);
       pstat_getdynamic(&dbuf, sizeof(dbuf), 1, 0);
       pgsizekb = sbuf.page_size / 1024;
       kpages = dbuf.psd_free / 1024;
       pgsizecnf = sysconf(_SC_PAGE_SIZE);
               switch(pgsizecnf) {
                      case 4096:
                          d = 256;
                          break;
                      case 8192:
                          d = 128;
                          break;
                      case 16384:
                          d = 64;
                          break;
                      case 65536:
                          d = 16;
                          break;
                      default:
                      exit (1);
                                }
       printf("Total:%ld\n", sbuf.physical_memory/d);
       printf("Free:%lu\n", pgsizekb*kpages);
}




Jason A.J. Fredricksen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20110222/f6d0a278/attachment.html>


More information about the Xymon mailing list