Example #1
0
static void main_service_ready (void)
{
	int res;
	/*
	 * This must occur after totempg is initialized because "this_ip" must be set
	 */
	res = corosync_service_defaults_link_and_init (api);
	if (res == -1) {
		log_printf (LOGSYS_LEVEL_ERROR, "Could not initialize default services\n");
		corosync_exit_error (AIS_DONE_INIT_SERVICES);
	}
	evil_init (api);
	corosync_stats_init ();
	corosync_totem_stats_init ();
	if (minimum_sync_mode == CS_SYNC_V2) {
		log_printf (LOGSYS_LEVEL_NOTICE, "Compatibility mode set to none.  Using V2 of the synchronization engine.\n");
		sync_v2_init (
			corosync_sync_v2_callbacks_retrieve,
			corosync_sync_completed);
	} else
	if (minimum_sync_mode == CS_SYNC_V1) {
		log_printf (LOGSYS_LEVEL_NOTICE, "Compatibility mode set to whitetank.  Using V1 and V2 of the synchronization engine.\n");
		sync_register (
			corosync_sync_callbacks_retrieve,
			sync_v2_memb_list_determine,
			sync_v2_memb_list_abort,
			sync_v2_start);

		sync_v2_init (
			corosync_sync_v2_callbacks_retrieve,
			corosync_sync_completed);
	}


}
Example #2
0
/**
 * Set up connections, signal handlers, sockets etc.
 * @return 1 or greater on success, 0 otherwise
 *
 * This function sets up all singal handlers and the basic event loop. If it
 * succeeds, 1 will be returned, otherwise 0 will be returned.
 *
 * @code
 * #include <Ecore.h>
 *
 * int main(int argc, char **argv)
 * {
 *   if (!ecore_init())
 *   {
 *     printf("ERROR: Cannot init Ecore!\n");
 *     return -1;
 *   }
 *   ecore_main_loop_begin();
 *   ecore_shutdown();
 * }
 * @endcode
 */
EAPI int ecore_init(void)
{
	if (++_ecore_init_count != 1)
		return _ecore_init_count;

#ifdef HAVE_LOCALE_H
	setlocale(LC_CTYPE, "");
#endif
	/*
	   if (strcmp(nl_langinfo(CODESET), "UTF-8"))
	   {
	   WRN("Not a utf8 locale!");
	   }
	 */
#ifdef HAVE_EVIL
	if (!evil_init())
		return --_ecore_init_count;
#endif
	if (!eina_init())
		goto shutdown_evil;
	_ecore_log_dom =
	    eina_log_domain_register("Ecore", ECORE_DEFAULT_LOG_COLOR);
	if (_ecore_log_dom < 0) {
		EINA_LOG_ERR("Ecore was unable to create a log domain.");
		goto shutdown_log_dom;
	}
	if (getenv("ECORE_FPS_DEBUG"))
		_ecore_fps_debug = 1;
	if (_ecore_fps_debug)
		_ecore_fps_debug_init();
	_ecore_main_loop_init();
	_ecore_signal_init();
	_ecore_exe_init();
	_ecore_thread_init();
	_ecore_glib_init();
	_ecore_job_init();
	_ecore_time_init();

#if HAVE_MALLINFO
	if (getenv("ECORE_MEM_STAT")) {
		_ecore_memory_pid = getpid();
		ecore_animator_add(_ecore_memory_statistic, NULL);
	}
#endif

#if defined(GLIB_INTEGRATION_ALWAYS)
	if (_ecore_glib_always_integrate)
		ecore_main_loop_glib_integrate();
#endif

	return _ecore_init_count;

      shutdown_log_dom:
	eina_shutdown();
      shutdown_evil:
#ifdef HAVE_EVIL
	evil_shutdown();
#endif
	return --_ecore_init_count;
}
Example #3
0
int
main(void)
{
   test tests[] = {
     { "dlfcn       ",  test_dlfcn },
     { "environment ",  test_environment },
     { "gettimeofday",  test_gettimeofday },
     { "link        ",  test_link },
     { "mkstemp     ",  test_mkstemp },
     { "pipe        ",  test_pipe },
     { "print       ",  test_print },
     { "realpath    ",  test_realpath },
     { "util        ",  test_util },
/*      { "memcpy      ",  test_memcpy }, */
     { NULL,            NULL },
   };
   suite *s;
   int    i;

   if (!evil_init())
     return EXIT_FAILURE;

   s = suite_new();
   if (!s)
     {
        evil_shutdown();
        return EXIT_FAILURE;
     }

   for (i = 0; tests[i].name; ++i)
     {
        suite_test_add(s, tests[i].name, tests[i].fct);
     }

   suite_run(s);

   suite_show(s);

   suite_del(s);
   evil_shutdown();

   return EXIT_SUCCESS;
}