On Thu, 11 Sep 2014 11:58:34 +0800 xinyilong wrote:
X> Dear all,
X> I have met a stack overflow in select(), because there are more than 1024
X> fds in my app. I found some large fd APIs in net-snmp 5.7.2, but I did not
X> find how to use those APIs, expecially in the agent_check_and_process() as
X> below.
X> 
X> How to use those APIs in the snmp_synch_response_cb as below, I think those
X> APIs do not work well with select


You should use the macros defined in  large_fd_set.h:


/**
 * Add socket fd to the set *fdset if not yet present.
 * Enlarges the set if necessary.
 */
#define NETSNMP_LARGE_FD_SET(fd, fdset)

/**
 * Remove socket fd from the set *fdset.
 * Do nothing if fd is not present in *fdset.
 * Do nothing if fd >= fdset->lfs_setsize.
 */
#define NETSNMP_LARGE_FD_CLR(fd, fdset)

/**
 * Test whether set *fdset contains socket fd.
 * Evaluates to zero (false) if fd >= fdset->lfs_setsize.
 */
#define NETSNMP_LARGE_FD_ISSET(fd, fdset)

#if !defined(cygwin) && defined(HAVE_WINSOCK_H)

/**
 * Number of bytes needed to store a number of file descriptors as a
 * struct fd_set.
 */
#define NETSNMP_FD_SET_BYTES(setsize)

/** Remove all sockets from the set *fdset. */
#define NETSNMP_LARGE_FD_ZERO

If the agent is crashing on the select in snmp_synch_response_cb, try chaning
it to netsnmp_large_fd_set_select(...) and let us know if that fixes the
problem (by filing a bug report, along with your OS and net-snmp versions).


Robert

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to