Hi All,

I have a requirement to run SNMP Agent as a thread in my application  (The
application in running on Linux based embedded system).

Following are the changes I have done for same:
1. Modified main() function in agent/snmpd.c to snmpd_main().
2. Compile snmpd.c as a shared library which is linked in my main
application.
3. Start snmpd_main() function as a thread from my application. The argument
passed are "-C --rwcommunity=test".

As soon as I start my application, it works for some time, but becomes
unusable after that(hangs). I see some code in snmpd.c which closes all file
descriptors.

=====
 /*
     * close all non-standard file descriptors we may have
     * inherited from the shell.
     */
    for (i = getdtablesize() - 1; i > 2; --i) {
        (void) close(i);
    }

=====

I am not sure why this code is closing all the file descriptors. If this
code is removed, my application gives page fault.

Have anybody run snmp agent as a thread in Linux.


Thanks,
Jatinder
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
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