On 5/15/15, Bart Van Assche <bvanass...@acm.org> wrote:
> Hello Dixon,
>
> Can you provide more information about which Net-SNMP version has been
> tested, which steps were followed to download the source code and can
> you also provide the output for the T009large_fd_set_clib unit test ?
>
> Thanks,
>
> Bart.
>
>


Hello Bart,

We are using NetSNMP release 5.7.3.
Source is downloaded from sourceforge:
http://sourceforge.net/projects/net-snmp/files/net-snmp/5.7.3/net-snmp-5.7.3.tar.gz/download

We didn't have the Test::Harness perl module installed, so we compiled
the T009large_fd_set_clib unit test manually with adding required
headers/macros.
And all the tests passed - with and without patch - even with original
version - 5.7.3 release.

We suspect the problem is not using large_fd_set apis, but using FD_*
macros for fds set with LFD_*.

As we previously pointed out, these are our observations:
In Linux X64, sys/select.h:
  ...
  typedef long int __fd_mask;
  ...
  #define __NFDBITS       (8 * sizeof (__fd_mask))
  ...
  typedef struct
    {
  ...
      __fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS];
  ...
    } fd_set;
  ...

In HP-UX IA64, /usr/include/sys/_fd_macros.h:
  ...
  typedef int32_t __fd_mask;
  ...
  #define _NFDBITS (sizeof(__fd_mask) * 8)     /* 8 bits per byte *
  ...
  #define __howmany(x,y)  (((x)+((y)-1))/(y))
  ...
  typedef struct __fd_set {
   long fds_bits[__howmany(FD_SETSIZE, (sizeof(long) * 8))];
   } fd_set;
  ...
  #ifdef _INCLUDE_HPUX_SOURCE
  #    define FD_SET(n,p)  (((__fd_mask
*)((p)->fds_bits))[(n)/_NFDBITS] |= (1 << ((n) % _NFDBITS)))
  #    define FD_CLR(n,p) (((__fd_mask
*)((p)->fds_bits))[(n)/_NFDBITS] &= ~(1 << ((n) % _NFDBITS)))
  #    define FD_ISSET(n,p) (((__fd_mask
*)((p)->fds_bits))[(n)/_NFDBITS] & (1 << ((n) % _NFDBITS)))
  #    define FD_ZERO(p)     memset((void *)(p), (int) 0, sizeof(*(p)))
  #else
  ...


Please note, in HP-UX,
fd_bits is an array of long(64 bit) and
__fd_mask is still 32 bit.

So, on the platform in 64 bit mode,
  For fd=0,  bit 32 of fd_bits[0] need to be set (or, will be set by FD_SET)
  But, LFD_SET macro will set bit 0 of fd_bits[0]

So, this causes issue when select (which uses system's LD_* macros)
uses fds returned by snmp_select_info(which uses custom LFD_*
routines).

Please let us know if you need any further details.

Regards,
Dixon Xavier

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to