Пример #1
0
static int vss_opts_changed(struct sdirs *sdirs, struct conf *cconf,
	const char *incexc)
{
	int ret=0;
	struct conf oldconf;
	struct conf newconf;
	conf_init(&oldconf);
	conf_init(&newconf);

	// Figure out the old config, which is in the incexc file left
	// in the current backup directory on the server.
	if(parse_incexcs_path(&oldconf, sdirs->cincexc))
	{
		// Assume that the file did not exist, and therefore
		// the old split_vss setting is 0.
		oldconf.split_vss=0;
		oldconf.strip_vss=0;
	}

	// Figure out the new config, which is either in the incexc file from
	// the client, or in the cconf on the server.
	if(incexc)
	{
		if(parse_incexcs_buf(&newconf, incexc))
		{
			// Should probably not got here.
			newconf.split_vss=0;
			newconf.strip_vss=0;
		}
	}
	else
	{
		newconf.split_vss=cconf->split_vss;
		newconf.strip_vss=cconf->strip_vss;
	}

	if(newconf.split_vss!=oldconf.split_vss)
	{
		logp("split_vss=%d (changed since last backup)\n",
			newconf.split_vss);
		ret=1;
	}
	if(newconf.strip_vss!=oldconf.strip_vss)
	{
		logp("strip_vss=%d (changed since last backup)\n",
			newconf.strip_vss);
		ret=1;
	}
	if(ret) logp("All files will be treated as new\n");
	return ret;
}
Пример #2
0
int conf_load(struct conf *conf, const char *conf_name,
              char *config_search_dirs[], char *plugin_search_dirs[])
{
	conf_init(conf);
	cur_conf = conf;

	cur_conf->config_search_dirs = config_search_dirs;
	cur_conf->plugin_search_dirs = plugin_search_dirs;
	if (!(yyin = conf_push_config(cur_conf, conf_name, NULL))) {
		return -1;
	}

	if (yyparse()) {
		if (fclose(yyin)) {
			wminput_err("Error closing configuration file");
		}
		conf_unload(cur_conf);
		return -1;
	}

	if (uinput_open(cur_conf)) {
		conf_unload(cur_conf);
		return -1;
	}

	return 0;
}
Пример #3
0
Файл: prog.c Проект: jkniiv/burp
int reload(struct conf *conf, const char *conffile, bool firsttime,
           int oldmax_children, int oldmax_status_children, int json)
{
    if(!firsttime) logp("Reloading config\n");

    conf_init(conf);

    if(conf_load(conffile, conf, 1)) return 1;

    /* change umask */
    umask(conf->umask);

    // Try to make JSON output clean.
    if(json) conf->log_to_stdout=0;

    // This will turn on syslogging which could not be turned on before
    // conf_load.
    set_logfp(NULL, conf);

#ifndef HAVE_WIN32
    if(conf->mode==MODE_SERVER)
        setup_signals(oldmax_children, conf->max_children,
                      oldmax_status_children, conf->max_status_children);
#endif

    // Do not try to change user or group after the first time.
    if(firsttime && chuser_and_or_chgrp(conf))
        return 1;

    return 0;
}
Пример #4
0
void test2() {
	struct aug_conf c;
	int argc = 1;
	char *argv[] = {g_argv[0], NULL};
	const char *path = "/tmp/augrc";
	dictionary *ini;
	FILE *f = fopen(path, "w");
	if(f == NULL)
		err(1, "file: %s", path);
	fclose(f);

	diag("blank ini file and no args");
	ini = ciniparser_load(path);
	ok1(ini != NULL);

	conf_init(&c);
	ok1(opt_parse(argc, argv, &c) == 0);
	ok1(opt_set_amt(&c) == 0);
	conf_merge_ini(&c, ini);	
	ok1( compare_conf_vals(&c, &g_default_conf) == 0);

	conf_free(&c);
#define TEST2AMT 4
	
	ciniparser_freedict(ini);
	unlink(path);
}
Пример #5
0
int main(int argc, char *argv[])
{
	int i, len, total_tests;
#define TESTN(_num) {test##_num, TEST##_num##AMT}
	struct conf_test tests[] = {
		TESTN(1),
		TESTN(2),
		TESTN(3),
		TESTN(4),
		TESTN(5)
	};

	g_argc = argc;
	g_argv = argv;
	conf_init(&g_default_conf);

	total_tests = 0;	
	len = AUG_ARRAY_SIZE(tests);
	for(i = 0; i < len; i++) {
		total_tests += tests[i].amt;
	}

	plan_tests(total_tests);

	for(i = 0; i < len; i++) {
		(*tests[i].fn)();
	}

	return exit_status();
}
Пример #6
0
int my_conf_init(const char *log)
{
    int res;

    if( (res = conf_init(log)) < 0 ){
        return res;
    }

    CONF_FILL_INT(daemon);
    CONF_FILL_INT(worker);
    CONF_FILL_INT(max_connections);
    CONF_FILL_STR(ip);
    CONF_FILL_STR(port);
    CONF_FILL_INT(read_client_timeout);
    CONF_FILL_INT(write_mysql_timeout);
    CONF_FILL_INT(read_mysql_write_client_timeout);
    CONF_FILL_INT(prepare_mysql_timeout);
    CONF_FILL_INT(idle_timeout);
    CONF_FILL_INT(mysql_ping_timeout);
    CONF_FILL_STR(user);
    CONF_FILL_STR(passwd);
    CONF_FILL_STR(mysql_conf);
    CONF_FILL_STR(log);
    CONF_FILL_STR(loglevel);
    CONF_FILL_STR(sqllog);

    return 0;
}
Пример #7
0
int
config_read_file(char *path)
{
	HASH_CTX *hctx;
	int xerror;
	char ebuf[BUFSIZ];

	if (path == NULL)
	{
		if (Cfilename == NULL)
			return errno = EINVAL;
		else
			path = Cfilename;
	}
	else
		Cfilename = str_dup(path, __FILE__, __LINE__);

	hctx = conf_init(NULL, path, ebuf, sizeof ebuf);
	if (hctx == NULL)
	{
		xerror = (errno == 0) ? errno = ENOMEM : errno;
		(void) fprintf(stderr, "Read: %s\n", ebuf);
		return errno = xerror;
	}

	(void) pthread_mutex_lock(&Hconfmutex);
	 if (Hconfbak != NULL)
		Hconfbak = conf_shutdown(Hconfbak);
	 Hconfbak = Hconf;
	 Hconf = hctx;
	(void) pthread_mutex_unlock(&Hconfmutex);
	return errno=0;
}
Пример #8
0
int main( int argc, char *argv[] )
{
	conf_t conf[1];
	search_t *res;
	int i, j;
	
	if( argc != 2 )
	{
		fprintf( stderr, "Incorrect amount of arguments\n" );
		return( 1 );
	}
	
	conf_init( conf );
	
	res = malloc( sizeof( search_t ) * ( conf->search_amount + 1 ) );
	memset( res, 0, sizeof( search_t ) * ( conf->search_amount + 1 ) );
	res->conf = conf;
	
	i = search_makelist( res, argv[1] );
	if( i == -1 )
	{
		fprintf( stderr, "File not found\n" );
		return( 1 );
	}
	printf( "%i usable mirrors:\n", search_getspeeds( res, i ) );
	search_sortlist( res, i );
	for( j = 0; j < i; j ++ )
		printf( "%-70.70s %5i\n", res[j].url, res[j].speed );
	
	return( 0 );
}
Пример #9
0
int main(int argc, LPSTR argv[]) {
	int ret;
	Config conf;
	TCHAR conf_file[MAX_PATH];
	
	conf_init(&conf);
	
	ret = GetModuleFileName(NULL, conf_file, MAX_PATH);
	if (ret <= 0) {
		my_message_box("Unable to GetModuleFileName ... (code: %d)\n", ret);
		return 1;
	}
	
	PathRemoveExtension(conf_file);
	PathAddExtension(conf_file, ".ini");
	      
	if (! PathFileExists(conf_file)) {
		my_message_box("No such file %s\n", conf_file);
		return 1;
	}
	
	read_conf(conf_file, &conf);
	
	if (conf.delay != 0)
		Sleep(conf.delay * 1000);
	
	ret = launch(conf);
	return ret;
}
Пример #10
0
void
init(void)
{
	app_init();
	doi_init();
	exchange_init();
	group_init();
	ipsec_init();
	isakmp_doi_init();
	libcrypto_init();

	timer_init();

	/* The following group are depending on timer_init having run.  */
	conf_init();
	connection_init();

	/* This depends on conf_init, thus check as soon as possible. */
	log_reinit();

	/* policy_init depends on conf_init having run.  */
	policy_init();

	/* Depends on conf_init and policy_init having run */
	cert_init();
	crl_init();

	sa_init();
	transport_init();
	virtual_init();
	udp_init();
	nat_t_init();
	udp_encap_init();
	vendor_init();
}
Пример #11
0
/**
 * Konstruktor opens the configuration, which is given by the filename
 */
config::config(char* filename){
	myfilename = filename;
	fp = fopen(myfilename, "r");
	group = NULL;
	conf_init(&conf);
	conf_read(&conf, fp);
	fclose(fp);
}
Пример #12
0
Файл: m_pd.c Проект: Tzero2/pd
void pd_init(void)
{
    mess_init();
    obj_init();
    conf_init();
    glob_init();
    garray_init();
}
Пример #13
0
int os_main(int argc, char* argv[])
{
	adv_conf* context;
	char* section_map[1];

	context = conf_init();

	if (os_init(context) != 0)
		goto err_conf;

	inputb_reg(context, 1);
	inputb_reg_driver_all(context);

	if (conf_input_args_load(context, 0, "", &argc, argv, error_callback, 0) != 0)
		goto err_os;

	if (argc > 1) {
		fprintf(stderr, "Unknown argument '%s'\n", argv[1]);
		goto err_os;
	}

	section_map[0] = "";
	conf_section_set(context, section_map, 1);

	if (inputb_load(context) != 0)
		goto err_os;

	if (os_inner_init("AdvanceINPUT") != 0)
		goto err_os;

	if (inputb_init() != 0)
		goto err_os_inner;

	if (inputb_enable(0) != 0)
		goto err_input;

	run();

	inputb_disable();
	inputb_done();
	os_inner_done();
	os_done();
	conf_done(context);

	return EXIT_SUCCESS;

err_input:
	inputb_done();
err_os_inner:
	os_inner_done();
err_os:
	os_done();
err_conf:
	conf_done(context);
	return EXIT_FAILURE;

}
Пример #14
0
int settings_init(const char *path) {
    settings_path = path;
    memset(&_settings, 0, sizeof(settings));
    for(int i = 0;i < sizeof(struct_to_fields)/sizeof(struct_to_field);i++) {
        const struct_to_field *s2f = &struct_to_fields[i];
        settings_add_fields(s2f->fields, s2f->num_fields);
    }
    return conf_init(settings_path);
}
Пример #15
0
int kadnode_init(void) {
	if (gconf == NULL) {
		// Setup gconf
		conf_init();
		return 0;
	} else {
		return 1;
	}
}
Пример #16
0
static rmt_conf *
conf_open(char *filename)
{
    int ret;
    rmt_conf *cf = NULL;
    FILE *fh = NULL;
    sds path = NULL;

    if (filename == NULL) {
        log_error("ERROR: configuration file name is NULL.");
        return NULL;
    }

    path = getAbsolutePath(filename);
    if (path == NULL) {
        log_error("ERROR: configuration file name '%s' is error.", filename);
        goto error;
    }

    fh = fopen(path, "r");
    if (fh == NULL) {
        log_error("ERROR: failed to open configuration '%s': %s", path,
                  strerror(errno));
        goto error;
    }

    cf = rmt_alloc(sizeof(*cf));
    if (cf == NULL) {
        goto error;
    }

    ret = conf_init(cf);
    if(ret != RMT_OK){
        goto error;
    }

    cf->fname = path;
    cf->fh = fh;

    return cf;

error:

    if(fh != NULL) {
        fclose(fh);
    }

    if (cf != NULL) {
        conf_destroy(cf);
    }

    if (path != NULL) {
        sdsfree(path);
    }
    
    return NULL;
}
Пример #17
0
int main(int argc, char **argv)
{
	struct sigaction sig_stop;
	struct sigaction sig_time;

	_main = main_init(argc, argv);
	_log = log_init();
	_main->conf = conf_init(argc, argv);
	_main->work = work_init();

	_main->tcp = tcp_init();
	_main->node = node_init();
	_main->mime = mime_init();

	/* Check configuration */
	conf_print();

	/* Catch SIG INT */
	unix_signal(&sig_stop, &sig_time);

	/* Fork daemon */
	unix_fork(log_console(_log));

	/* Increase limits */
	unix_limits(_main->conf->cores, CONF_EPOLL_MAX_EVENTS);

	/* Load mime types */
	mime_load();
	mime_hash();

	/* Prepare TCP daemon */
	tcp_start();

	/* Drop privileges */
	unix_dropuid0();

	/* Start worker threads */
	work_start();

	/* Stop worker threads */
	work_stop();

	/* Stop TCP daemon */
	tcp_stop();

	mime_free();
	node_free();
	tcp_free();

	work_free();
	conf_free();
	log_free(_log);
	main_free();

	return 0;
}
Пример #18
0
int main()
{
	conf_init();
	log_reset();
	log_daemon();
	while(1)
	{
		sleep(10);
	}
}
Пример #19
0
void pd_init(void)
{
    if (!pd_this)
        pd_this = pdinstance_donew(0);
    mess_init();
    obj_init();
    conf_init();
    glob_init();
    garray_init();
}
Пример #20
0
/**	函数名:	pool_init 
  * 功能描述:	初始化线程池
  *	参数列表:	max_thread_num :输入要建的线程池的线程最大数目
  *	返回值:	无
  */
void pool_init(int max_thread_num)
{
	int i;
	conf_init();
	if(max_thread_num < g_min_thread_num)
	{
		max_thread_num = g_min_thread_num;
	}
	else if(max_thread_num > g_max_thread_num)
	{
		max_thread_num = g_max_thread_num;
	}
	pthread_attr_t attr;
	int err;
	err= pthread_attr_init(&attr);
	if(err != 0)
	{
		perror("pthread_attr_init");
		exit(1);
	}
	err = pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED);

	if(err != 0)
	{
		perror("pthread_attr_setdetachstate");
		exit(1);
	}

	g_pool = (thread_pool *)malloc(sizeof(thread_pool));
	
	pthread_mutex_init(&(g_pool->queue_lock),NULL);
	pthread_mutex_init(&(g_pool->remove_queue_lock),NULL);
	pthread_cond_init(&(g_pool->queue_ready),NULL);

	g_pool->queue_head = NULL;
	g_pool->max_thread_num = max_thread_num;
	g_pool->thread_queue =NULL;
	g_pool->thread_idle_queue = NULL;
	g_pool->idle_queue_num = 0;
	g_pool->cur_queue_size = 0;
	g_pool->shutdown = 0;

	int temp;
	for(i = 0; i < max_thread_num; i++)
	{
		pthread_t thread_id;
		pthread_create(&thread_id,&attr,thread_routine,NULL);
		thread_queue_add_node(&(g_pool->thread_queue),thread_id,&temp);
		printf("temp&&&&&&&&&&&&&%d\n",temp);

	}
	
	pthread_attr_destroy(&attr);

}
Пример #21
0
void * thread_manage(void *arg)
{
	int optvalue;
	int thread_num;
	while(1)
	 {
	 
		 if(g_pool->cur_queue_size > g_thread_worker_high_ratio * g_pool->max_thread_num)
	 	{
			 optvalue = 1;
			 thread_num =(g_pool->cur_queue_size -g_thread_worker_high_ratio * g_pool->max_thread_num) / g_thread_worker_high_ratio;
		}
	 	else if (g_pool->cur_queue_size * g_thread_worker_low_ratio < g_pool->max_thread_num)
	 	{
			optvalue = 2;
			thread_num =(g_pool->max_thread_num -g_thread_worker_low_ratio * g_pool->cur_queue_size) / g_thread_worker_low_ratio;
	 	}
	 
		if(1 == optvalue)
	 	{
			
			if(g_pool->max_thread_num + thread_num > g_max_thread_num)
			{
				thread_num = g_max_thread_num - g_pool->max_thread_num;
			}
			pool_add_thread(thread_num);
			
	 	}
		else if( 2 == optvalue)
		{
			if(g_pool->max_thread_num - thread_num < g_min_thread_num)
			{
				thread_num = g_pool->max_thread_num - g_min_thread_num;
			}
		//	pthread_t revoke_tid;
		//	pthread_create(&revoke_tid,NULL,(void *)pool_revoke_thread,(void *)thread_num);
			pool_revoke_thread(thread_num);
	 	}

		printf("==========ManageThread=============\n");

		printf("cur_queue_size = %d  |  max_thread_num = %d\n",g_pool->cur_queue_size,g_pool->max_thread_num);
		conf_init();
		sleep(g_manage_adjust_interval);
 }



	
	
}
Пример #22
0
void test5() {
	struct aug_conf c;
	char *argv[] = {g_argv[0], "--no-color", NULL};
	int argc = AUG_ARRAY_SIZE(argv) - 1;

	diag("does the no color flag work?");
	conf_init(&c);
	ok1(opt_parse(argc, argv, &c) == 0);
	ok1(c.nocolor != false);
	ok1(opt_set_amt(&c) == 1);
	
#define TEST5AMT 3
	conf_free(&c);
}
Пример #23
0
void test1() {
	struct aug_conf c;
	int argc = 1;
	char *argv[] = {g_argv[0], NULL};

	conf_init(&c);
	diag("no ini file and no args");
	ok1(opt_parse(argc, argv, &c) == 0);
	ok1(opt_set_amt(&c) == 0);
	ok1( compare_conf_vals(&c, &g_default_conf) == 0);

	conf_free(&c);
#define TEST1AMT 3
}
Пример #24
0
/**
   @brief AutoBuilder Entry Point
   @param argc Number of arguments passed through argv
   @param argv String representation of arguments passed to the
   application
   @return EXIT_SUCCESS on success or a non-zero integer on failure.
**/
int
main (int argc, char ** argv)
{
  conf_t conf;
  conf_err_t cerr;
  opt_t opt;
  opt_err_t oerr;
  const char *db_type, *db_host, *db_port, *db_user, *db_pass, *db_db;

  /* Parse the command line */
  oerr = opt_init(&opt, argc, argv, 1);
  if (oerr != OPT_OK)
    {
      fprintf (stderr, "%s\n", SHORT_HELP);
      opt_destroy (&opt);
      return EXIT_FAILURE;
    }
  if (opt.help)
    {
      fprintf (stderr, "%s\n", HELP_TXT);
      return EXIT_SUCCESS;
    }

  /* Parse the configuration */
  cerr = conf_init (&conf, opt.conf);
  if (cerr != CONF_OK)
    {
      fprintf (stderr, "Configuration Error: %s", conf_get_err (&conf));
      conf_destroy (&conf);
      opt_destroy (&opt);
      return EXIT_FAILURE;
    }

  /* Read Database Options */
  db_type = conf_get (&conf, "DB_TYPE");
  db_host = conf_get (&conf, "DB_HOST");
  db_port = conf_get (&conf, "DB_PORT");
  db_user = conf_get (&conf, "DB_USER");
  db_pass = conf_get (&conf, "DB_PASS");
  db_db   = conf_get (&conf, "DB_DB");

  /* Connect to the database */
  //db_connect (db_type, db_host, db_port, db_user, db_pass, db_db);

  /* Cleanup */
  conf_destroy (&conf);
  opt_destroy (&opt);

  return EXIT_SUCCESS;
}
Пример #25
0
/* Module initialization function */
static int mod_init(void)
{
	if (init_shmlock() != 0) {
		LM_CRIT("cannot initialize shmlock.\n");
		return -1;
	}

	if (conf_init(mp_max_id) < 0) {
		LM_CRIT("cannot initialize configuration.\n");
		return -1;
	}

	/* read module parameters and update configuration structure */
	if (conf_parse_proxy(mp_proxy) < 0) {
		LM_CRIT("cannot parse proxy module parameter.\n");
		return -1;
	}
	if (conf_parse_filter(mp_filter) < 0) {
		LM_CRIT("cannot parse filter module parameter.\n");
		return -1;
	}
	if (conf_parse_switch(mp_switch) < 0) {
		LM_CRIT("cannot parse switch module parameter.\n");
		return -1;
	}

	if (forward_active == 1) {
		/* register callback for id 0 */
		if (register_script_cb(pre_script_filter, PRE_SCRIPT_CB|ONREPLY_CB, 0) < 0) {
			LM_CRIT("cannot register script callback for requests.\n");
			return -1;
		}
		if (register_script_cb(pre_script_filter, PRE_SCRIPT_CB|ONREPLY_CB, 0) < 0) {
			LM_CRIT("cannot register script callback for replies.\n");
			return -1;
		}
	} else {
		LM_INFO("forward functionality disabled");
	}

	/* presence database */
	LM_DBG("pres_db_url=%s/%d/%p\n", ZSW(pres_db_url.s), pres_db_url.len,
			pres_db_url.s);

	if(pres_db_init() < 0) {
		return -1;
	}

	return 0;
}
Пример #26
0
void
game_init (const char *name)
{
  if (true == initialized)
    {
      LOG_FATAL ("already initialized");
    }

  conf_init ();

  log_set_name (name);
  log_set_verbose (conf_get_verbose ());

  filepath_init (conf_get_root ());
  video_init (conf_get_ratio (), conf_get_center ());
  keyboard_init ();

  char * const music_root = xmalloc (PATH_MAX);
  xsnprintf (music_root, PATH_MAX, "%s%cmusic", conf_get_root (),
             FILEPATH_SEPARATOR);
  audio_init (music_root);
  free (music_root);

  if (false == conf_get_music ())
    {
      audio_music_mute ();
    }
  if (false == conf_get_sound ())
    {
      audio_sound_mute ();
    }

  mouse_init ();

  pit_isr_is_installed = false;

  if (conf_get_fast ())
    {
      game_set_fps_high ();
    }
  else
    {
      game_set_fps_low ();
    }

  exit_clear ();

  initialized = true;
}
Пример #27
0
static int __license_sniffer_capacity(long *size)
{
        int ret;
        DIR *dir;
        struct dirent *ent;
        char path[MAX_PATH_LEN], parent[MAX_PATH_LEN];
        uint64_t total;

        long tmp = 0;
        *size = 0;

        ret = conf_init();
        if (ret)
                GOTO(err_ret, ret);

        dbg_sub_init();        

        strcpy(parent, gloconf.home);
        strcat(parent, "/data/disk/disk");

        dir = opendir(parent);
        if (!dir) {
                ret = errno;
                GOTO(err_ret, ret);
        }

        while ((ent = readdir(dir))) {
                if (!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, ".."))
                        continue;

                snprintf(path, sizeof(path), "%s/%s", parent, ent->d_name);

                ret = _disk_dfree_link(path, &total);
                if (ret)
                        GOTO(err_close, ret);

                tmp = total - cdsconf.disk_keep;
                *size += (tmp > 0 ? tmp : 0);
        }

        closedir(dir);

        return 0;
err_close:
        closedir(dir);
err_ret:
        return ret;
}
Пример #28
0
/**
 * main
 *
 * The main function for the project. This function initializes the os, calls
 * init_tasks to initialize tasks (and possibly other objects), then starts the
 * OS. We should not return from os start.
 *
 * @return int NOTE: this function should never return!
 */
int
main(int argc, char **argv)
{
    int rc;

#ifdef ARCH_sim
    mcu_sim_parse_args(argc, argv);
#endif

    conf_init();

    log_init();
    log_console_handler_init(&log_console_handler);
    log_register("log", &my_log, &log_console_handler);

    LOG_DEBUG(&my_log, LOG_MODULE_DEFAULT, "bla");
    LOG_DEBUG(&my_log, LOG_MODULE_DEFAULT, "bab");

    os_init();

    rc = os_mempool_init(&default_mbuf_mpool, DEFAULT_MBUF_MPOOL_NBUFS,
            DEFAULT_MBUF_MPOOL_BUF_LEN, default_mbuf_mpool_data,
            "default_mbuf_data");
    assert(rc == 0);

    rc = os_mbuf_pool_init(&default_mbuf_pool, &default_mbuf_mpool,
            DEFAULT_MBUF_MPOOL_BUF_LEN, DEFAULT_MBUF_MPOOL_NBUFS);
    assert(rc == 0);

    rc = os_msys_register(&default_mbuf_pool);
    assert(rc == 0);

    shell_task_init(SHELL_TASK_PRIO, shell_stack, SHELL_TASK_STACK_SIZE,
                    SHELL_MAX_INPUT_LEN);

    (void) console_init(shell_console_rx_cb);

    stats_module_init();

    rc = init_tasks();
    os_start();

    /* os start should never return. If it does, this should be an error */
    assert(0);

    return rc;
}
Пример #29
0
int ctdbd_config_load(TALLOC_CTX *mem_ctx,
		      struct conf_context **result)
{
	struct conf_context *conf = NULL;
	int ret = 0;
	char *conf_file =  NULL;

	ret = conf_init(mem_ctx, &conf);
	if (ret != 0) {
		return ret;
	}

	logging_conf_init(conf, "NOTICE");
	cluster_conf_init(conf);
	database_conf_init(conf);
	event_conf_init(conf);
	legacy_conf_init(conf);

	setup_config_pointers(conf);

	if (! conf_valid(conf)) {
		ret = EINVAL;
		goto fail;
	}

	conf_file = path_config(conf);
	if (conf_file == NULL) {
		D_ERR("Memory allocation error\n");
		ret = ENOMEM;
		goto fail;
	}
	ret = conf_load(conf, conf_file, true);
	/* Configuration file does not need to exist */
	if (ret != 0 && ret != ENOENT) {
		D_ERR("Failed to load configuration file %s\n", conf_file);
		goto fail;
	}

	talloc_free(conf_file);
	*result = conf;

	return 0;

fail:
	talloc_free(conf);
	return ret;
}
Пример #30
0
int main(int argc, char *argv[])
{
    sargc = argc;
    sargv = argv;

    gdk_threads_init();
    gtk_init(&argc, &argv);

    conf_init();
    build_mainwindow();

    gdk_threads_enter();
    gtk_main();
    gdk_threads_leave();

    return 0;
}