Frans Grotepass> Frans Grotepass wrote:
> > Hi, Firstus postus We use Net-SNMP for system health inspection. We
> > noticed that our 64 bit apps did not report their pr_size variable from
> > the psinfo struct correctly. Some info on the web shows that checking
> > with a 32 bit application give incorrect values for 64 bit applications.
> > What is the method to get correct values for these variables?
>
> OK, reading my previous post, I realise there is some missing info...
>
> This variable in psinfo translates to the hrSWRunPerfMem variable. This
> variable returns correct
> values for 32bit applications but goes to 0 for 64bit apps on Solaris 10.
>
> A 32bit compiled test C program using code similar to that in
> agent/mibgroup/host/hr_swrun.c also
> validates this behaviour. If this same application is compiled as 64bit,
> it gives correct return
> values of the 64 bit apps.
>
> I couldn't find any information on the net-snmp to explain this
> behaviour. Should I file a bug or
> must net-snmp be built as a 64 bit binary to solve this problem?
>
> We could build a work around using the pr_pctmem in the solaris psinfo
> struct, but I can not find a
> matching value in the mibs. It could be that it is not available via
> net_snmp This value
> translates to the used memory in a 15 bit fraction.
>
> Hope this clarifies my first message a little
>
Bump...
I received no response on this question... I dove into the code and added the
following patch. This results in suitable behaviour with a 32 bit build
accessing the data from 64 bit applications. The patch was done on v5.4.2 and
tested on Solaris 10. Hopefully this could be added to the main branch.
>>>>>PATCH START
--- hr_swrun_old.c 2008-12-05 09:49:08.760274490 +0100
+++ hr_swrun.c 2008-12-05 13:36:59.631522030 +0100
@@ -84,6 +84,11 @@
#include <net-snmp/agent/auto_nlist.h>
#include "kernel.h"
#ifdef solaris2
+#if _SLASH_PROC_METHOD_ && defined _ILP32
+#include <net-snmp/agent/cache_handler.h>
+#include <net-snmp/agent/hardware/memory.h>
+#endif
+
#include "kernel_sunos5.h"
#endif
#if defined(aix4) || defined(aix5) || defined(aix6)
@@ -1151,7 +1156,30 @@
long_return = (lowpsinfo.pr_rssize * MMU_PAGESIZE) / 1024;
#elif defined(solaris2)
#if _SLASH_PROC_METHOD_
+#ifdef _ILP32
+ if(0 == proc_buf->pr_rssize)
+ { /* Odds on that we are looking with a 32 bit app at a 64 bit
psinfo.*/
+ netsnmp_memory_info *mem;
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_PHYSMEM, 1 );
+ if (!mem)
+ {
+ long_return = 0;/* Tried my best, giving up.*/
+ }
+ else
+ {/* 0x8000 is the maximum range of pr_pctmem. devision of 1024 is
to go from B to kB*/
+ uint32_t pct_unit = (mem->size/0x8000) * (mem->units/1024);
+ long_return = proc_buf ? proc_buf->pr_pctmem * pct_unit : 0;
+ }
+ }
+ else
+ {
+ long_return = proc_buf ? proc_buf->pr_rssize : 0;
+
+ }
+#else /*_LP64*/
long_return = proc_buf ? proc_buf->pr_rssize : 0;
+#endif /*_LP64*/
+
#else
long_return = proc_buf->p_swrss;
#endif
>>>>>PATCH END
Best regards,
Frans Grotepass
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge Build the coolest Linux based applications with Moblin SDK & win
> great prizes Grand prize is a trip for two to an Open Source event anywhere
> in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Net-snmp-users mailing list
> [email protected]
> Please see the following page to unsubscribe or change other options:
> https://lists.sourceforge.net/lists/listinfo/net-snmp-users
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users