Пример #1
0
/*! \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;
}
Пример #2
0
static int process_event(Server *s, struct epoll_event *ev) {
        int r;
        Fifo *f;

        assert(s);

        if (!(ev->events & EPOLLIN)) {
                log_info("Got invalid event from epoll. (3)");
                return -EIO;
        }

        f = (Fifo*) ev->data.ptr;
        r = fifo_process(f);
        if (r < 0) {
                log_info_errno(r, "Got error on fifo: %m");
                fifo_free(f);
                return r;
        }

        return 0;
}