Example #1
0
int config_task()
{
    if(FV_OK != n_lib_init ("config", &g_cfg_flib_callback)){
        goto cfg_init_err_exit;
    }
    //f_daemon_init ();

    if (signal(SIGINT, cfg_recv_int) == SIG_ERR) {
        cfg_error("register signal SIGINT error\n");
        goto cfg_init_err_exit;
    }
    cfg_init();
	cfg_file_is_exist();
    cfg_params_load();
    cfg_dispatch_init ();
    //f_daemon_start ();
    //fixme
    //cfg_log_start();
    n_stb_notify_module_status(N_MOD_RUNNING);
	
    cfg_dispatch_start ();
cfg_init_err_exit:
    cfg_error ("cfg service stop!\n");
    //fixme
    //cfg_log_stop();
    cfg_uninit();
    n_lib_uninit();
    return 0;
}
Example #2
0
/**
Uninitializes this process.

@param last Whether shared resources should also be uninitialized.
@return 0 if successful and -1 otherwise.
**/
int uninit(const bool last) {
	int result = 0;

	/*
	Unitializes the shared memory segment.
	*/
	if (shm_detach() == -1) {
		result = -1;
	}
	if (last) {
		if (shm_uninit() == -1) {
			result = -1;
		}

		/*
		Unitializes the display.
		*/
		if (curs_set(1) == ERR
				|| orig_wrefresh(stdscr) == ERR//TODO remove
				|| nocbreak() == ERR
				|| echo() == ERR
				|| orig_endwin() == ERR)
		{
			probno = log_error(UNINIT_PROBLEM);
			result = -1;
		}
	}

	/*
	Unitializes the functions.
	*/
	if (lib_uninit() == -1) {
		result = -1;
	}

	/*
	Unitializes the configuration.
	*/
	if (cfg_uninit() == -1) {
		result = -1;
	}

	return result;
}