Title: Message
All,
 
We found the problem of read() on fd getting blocked when select() returns with a read-fd set. We were calling snmp_read() twice in our code flow and hence read() was getting blocked. This problem is now solved without any change in the net-snmp code.
 
Regards,
Suresh.
 
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Pamidipati Suresh-G20238
Sent: Tuesday, October 03, 2006 11:49 PM
To: net-snmp-users@lists.sourceforge.net
Subject: Can we make pipefds[0] in netsnmp_callback_transport() asnon-blocking fds.?

Hi All,
 
We are using Net-snmp-5.2.2 as Agentx subagent and master agent.
 
In Subagent, we are observing that "select()" returns with a read-fd set, but a subsequent "read()" call on that fd is getting blocked. The fd-pair being used here, is created using the "pipe()" call. 
 
We observed that read() call is blocked at line no 194 in netsnmp_callback_recv() function of snmpCallbackDomain.c file. Following is the code snippet.
 
    188     DEBUGMSGTL(("transport_callback", "hook_recv enter\n"));
    189
    190     while (rc < 0) {
    191 #ifdef WIN32
    192         rc = recv(mystuff->pipefds[0], newbuf, 1, 0);
    193 #else
    194         rc = read(mystuff->pipefds[0], newbuf, 1);
    195 #endif
    196         if (rc < 0 && errno != EINTR) {
    197             break;
    198         }
    199     }
    200
We have seen this problem in Montavista linux CGE - 4.0.
 
After going through the Net-snmp code, we found that pipefds created using pipe() call are not set as non-blocking fds.
Please let us know if we change the pipefds[0] as non-blocking fds as follows, will there be any impact in the functionality of Subagent and Master agent.
 
netsnmp_transport *
netsnmp_callback_transport(int to)
{
int enable_nbio;
. . .
. . .
    rc = pipe(mydata->pipefds);
    ioctl(mydata->pipefds[0], FIONBIO, &enable_nbio);
.  . .
. . .
}
 
Any information on this will be really helpful.
 
Thanks,
Suresh.
 
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to