[sr-dev] git:master: snmpstats: start the agentx process

Daniel-Constantin Mierla miconda at gmail.com
Fri Jan 28 16:23:05 CET 2011


Module: sip-router
Branch: master
Commit: 41e163ccd7ea6b52886e67928d453f454a239208
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=41e163ccd7ea6b52886e67928d453f454a239208

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Fri Jan 28 09:16:05 2011 +0100

snmpstats: start the agentx process

---

 modules_k/snmpstats/snmpstats.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/modules_k/snmpstats/snmpstats.c b/modules_k/snmpstats/snmpstats.c
index 9e52c03..248e693 100644
--- a/modules_k/snmpstats/snmpstats.c
+++ b/modules_k/snmpstats/snmpstats.c
@@ -266,6 +266,9 @@ static int mod_init(void)
 	/* Register the alarm checking function to run periodically */
 	register_timer(run_alarm_check, 0, ALARM_AGENT_FREQUENCY_IN_SECONDS);
 
+	/* add space for one extra process */
+	register_procs(1);
+
 	return 0;
 }
 
@@ -275,11 +278,21 @@ static int mod_init(void)
  * process, and register a handler for any state changes of our child. */
 static int mod_child_init(int rank) 
 {
+	int pid;
+
 	/* We only want to setup a single process, under the main attendant. */
 	if (rank != PROC_MAIN) {
 		return 0;
 	}
 
+	pid=fork_process(PROC_NOCHLDINIT, "SNMP AgentX", 1);
+	if (pid<0)
+		return -1; /* error */
+	if(pid==0){
+		/* child */
+		agentx_child(1);
+	}
+
 	/* Spawn a child that will check the system up time. */
 	spawn_sysUpTime_child();
 




More information about the sr-dev mailing list