[SR-Dev] git:master: mi_fifo: start FIFO listener process using SR interface
Daniel-Constantin Mierla
miconda at gmail.com
Thu Apr 16 20:32:20 CEST 2009
Module: sip-router
Branch: master
Commit: 90c2431e4c98bce05e59d8ee8421c0db3d16fefb
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=90c2431e4c98bce05e59d8ee8421c0db3d16fefb
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: Thu Apr 16 18:16:04 2009 +0200
mi_fifo: start FIFO listener process using SR interface
- register one extra process to SR core
- start the extra process from child PROC_MAIN
---
modules_k/mi_fifo/mi_fifo.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/modules_k/mi_fifo/mi_fifo.c b/modules_k/mi_fifo/mi_fifo.c
index a697626..b1425ce 100644
--- a/modules_k/mi_fifo/mi_fifo.c
+++ b/modules_k/mi_fifo/mi_fifo.c
@@ -43,6 +43,7 @@
#include "../../sr_module.h"
#include "../../dprint.h"
#include "../../ut.h"
+#include "../../pt.h"
#include "../../mem/mem.h"
#include "../../mem/shm_mem.h"
#include "../../lib/kmi/mi.h"
@@ -170,6 +171,9 @@ static int mi_mod_init(void)
}
}
+ /* add space for one extra process */
+ register_procs(1);
+
return 0;
}
@@ -177,6 +181,8 @@ static int mi_mod_init(void)
/*! \brief Initialize module for child processes */
static int mi_child_init(int rank)
{
+ int pid;
+
if (rank==PROC_TIMER || rank>0 ) {
if ( mi_writer_init(read_buf_size, mi_reply_indent)!=0 ) {
LM_CRIT("failed to init the reply writer\n");
@@ -184,6 +190,16 @@ static int mi_child_init(int rank)
}
}
+ if (rank==PROC_MAIN) {
+ pid=fork_process(100, "MI FIFO", 1);
+ if (pid<0)
+ return -1; /* error */
+ if(pid==0){
+ /* child */
+ fifo_process(1);
+ }
+ }
+
return 0;
}
More information about the sr-dev
mailing list