Exemplo n.º 1
0
/*
 * per-child initialization
 */
int init_child(int rank)
{
	if(async_task_child_init(rank)<0)
		return -1;

	return init_mod_child(modules, rank);
}
Exemplo n.º 2
0
static int init_mod_child( struct sr_module* m, int rank )
{
	if (m) {
		/* iterate through the list; if error occurs,
		 * propagate it up the stack
		 */
		if (init_mod_child(m->next, rank)!=0) return -1;
		if (m->exports.init_child_f) {
			LM_DBG("idx %d rank %d: %s [%s]\n", process_no, rank,
					m->exports.name, my_desc());
			if (m->exports.init_child_f(rank)<0) {
				LM_ERR("error while initializing module %s (%s)"
						" (idx: %d rank: %d desc: [%s])\n",
						m->exports.name, m->path, process_no, rank, my_desc());
				return -1;
			} else {
				/* module correctly initialized */
				return 0;
			}
		}
		/* no init function -- proceed with success */
		return 0;
	} else {
		/* end of list */
		return 0;
	}
}
Exemplo n.º 3
0
static int init_mod_child( struct sr_module* m, int rank, char *type )
{
	if (m) {
		/* iterate through the list; if error occurs,
		   propagate it up the stack */
		if (init_mod_child(m->next, rank, type)!=0)
			return -1;

		if (m->exports && m->exports->init_child_f) {
			LM_DBG("type=%s, rank=%d, module=%s\n", 
					type, rank, m->exports->name);
			if (m->exports->init_child_f(rank)<0) {
				LM_ERR("failed to initializing module %s, rank %d\n",
					m->exports->name,rank);
				return -1;
			} else {
				/* module correctly initialized */
				return 0;
			}
		}

		/* no init function -- proceed with success */
		return 0;
	} else {
		/* end of list */
		return 0;
	}
}
Exemplo n.º 4
0
static int init_mod_child( struct sr_module* m, int rank )
{
	if (m) {
		/* iterate through the list; if error occurs,
		   propagate it up the stack
		 */
		if (init_mod_child(m->next, rank)!=0) return -1;
		if (m->exports.init_child_f) {
			DBG("DEBUG: init_mod_child (%d): %s\n", rank, m->exports.name);
			if (m->exports.init_child_f(rank)<0) {
				LM_ERR("Error while initializing module %s (%s)\n",
							m->exports.name, m->path);
				return -1;
			} else {
				/* module correctly initialized */
				return 0;
			}
		}
		/* no init function -- proceed with success */
		return 0;
	} else {
		/* end of list */
		return 0;
	}
}
Exemplo n.º 5
0
/*
 * per-child initialization
 */
int init_child(int rank)
{
	char* type;

	type = 0;

	switch(rank) {
	case PROC_MAIN:     type = "PROC_MAIN";     break;
	case PROC_TIMER:    type = "PROC_TIMER";    break;
	case PROC_MODULE:   type = "PROC_MODULE";   break;
	case PROC_TCP_MAIN: type = "PROC_TCP_MAIN"; break;
	}

	if (!type) {
		if (rank>0)
			type = "CHILD";
		else
			type = "UNKNOWN";
	}

	return init_mod_child(modules, rank, type);
}
Exemplo n.º 6
0
/*
 * per-child initialization
 */
int init_child(int rank)
{
	return init_mod_child(modules, rank);
}