コード例 #1
0
ファイル: mi_fifo.c プロジェクト: abh-gitcs1989/opensips
static void fifo_process(int rank)
{
	FILE *fifo_stream;

	LM_DBG("new process with pid = %d created\n",getpid());

	fifo_stream = mi_init_fifo_server( mi_fifo, mi_fifo_mode,
		mi_fifo_uid, mi_fifo_gid, mi_fifo_reply_dir);
	if ( fifo_stream==NULL ) {
		LM_CRIT("The function mi_init_fifo_server returned with error!!!\n");
		exit(-1);
	}

	if( init_mi_child()!=0) {
		LM_CRIT("faild to init the mi process\n");
		exit(-1);
	}

	if ( mi_parser_init(read_buf_size)!=0 ) {
		LM_CRIT("failed to init the command parser\n");
		exit(-1);
	}

	if ( mi_writer_init(read_buf_size, mi_reply_indent)!=0 ) {
		LM_CRIT("failed to init the reply writer\n");
		exit(-1);
	}

	mi_fifo_server( fifo_stream );

	LM_CRIT("the function mi_fifo_server returned with error!!!\n");
	exit(-1);
}
コード例 #2
0
ファイル: mi_fifo.c プロジェクト: gbour/kamailio
/*! \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");
			return -1;
		}
	}

	if (rank==PROC_MAIN) {
		pid=fork_process(PROC_NOCHLDINIT, "MI FIFO", 1);
		if (pid<0)
			return -1; /* error */
		if(pid==0){
			/* child */

			/* initialize the config framework */
			if (cfg_child_init())
				return -1;

			fifo_process(1);
		}
	}

	return 0;
}
コード例 #3
0
ファイル: mi_fifo.c プロジェクト: abh-gitcs1989/opensips
static int mi_child_init(int rank)
{
	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");
			return -1;
		}
	}

	return 0;
}