Пример #1
1
int
main (int argc, char *argv[])
{
    conf_t conf;

    /*  FIXME: Revamp signal handlers.
     */
    if (posignal (SIGHUP, SIG_IGN) == SIG_ERR) {
        log_err (EMUNGE_SNAFU, LOG_ERR, "Failed to ignore signal=%d", SIGHUP);
    }
    if (posignal (SIGPIPE, SIG_IGN) == SIG_ERR) {
        log_err (EMUNGE_SNAFU, LOG_ERR, "Failed to ignore signal=%d", SIGPIPE);
    }
    /*  Close stdin since it is not used.
     */
    if (close (STDIN_FILENO) < 0) {
        log_errno (EMUNGE_SNAFU, LOG_ERR, "Failed to close standard input");
    }
    /*  Set stdout to be line buffered.
     */
    if (setvbuf (stdout, NULL, _IOLBF, 0) < 0) {
        log_err (EMUNGE_SNAFU, LOG_ERR,
            "Failed to line-buffer standard output");
    }
    log_open_file (stderr, argv[0], LOG_INFO, LOG_OPT_PRIORITY);
    conf = create_conf ();
    parse_cmdline (conf, argc, argv);

    start_threads (conf);
    process_creds (conf);
    stop_threads (conf);

    destroy_conf (conf);
    log_close_file ();
    exit (EMUNGE_SUCCESS);
}
Пример #2
0
int
main(int argc, char **argv)
{
	struct fstab *fs;

	umask(S_IWGRP | S_IWOTH);

	if (argc != 4) {
		error("Wrong number of arguments: %d", argc);
		return EXIT_FAILURE;
	}
	unitdir = argv[1];
	unitdirlen = strlen(argv[1]);

	parse_cmdline_files(get_timeout);

	while ((fs = getfsent()) != NULL) {
		if (strncmp(fs->fs_file, KDUMP_DIR, KDUMP_DIR_LEN))
			continue;

		unescape_fstab(fs->fs_spec);
		create_conf(fs->fs_spec);
	}

	return EXIT_SUCCESS;
}
Пример #3
0
//////////////////////////////////////////////////////Cgminer connection attempts to restart after 5 seconds, if the connection fails, wait 5 seconds, trying to connect to 5 times
////////////Set up the parameter of miner and pool//////////////////////////////
//write  cgminer.conf
int write_config_s4(PKG_Format pkg_struct)
{
    GETS4_CONFIG *new_pools_data;
    new_pools_data=creat_newpools(rev_pools(pkg_struct.pkg_body,&changed_pools),save_old_conf(bb_black_cgc_dir,&get_cgminer_conf));

    create_conf(new_pools_data,bb_black_cgc_dir);
    //restart_cgminer();
    return 1;
}
Пример #4
0
struct cw_conference* start_conference( struct cw_conf_member* member ) 
{
    struct cw_conference* conf = NULL ;

    // check input
    if ( member == NULL )
    {
    	cw_log( LOG_WARNING, "unable to handle null member\n" ) ;
    	return NULL ;
    }

    // look for an existing conference
    cw_log( CW_CONF_DEBUG, "attempting to find requested conference\n" ) ;

    // acquire mutex
    cw_mutex_lock( &start_stop_conf_lock ) ;

    conf = find_conf( member->id ) ;
	
    // unable to find an existing conference, try to create one
    if ( conf == NULL )
    {
	// create a new conference
	cw_log( CW_CONF_DEBUG, "attempting to create requested conference\n" ) ;
	
	// create the new conference with one member
	conf = create_conf( member->id, member ) ;

	// return an error if create_conf() failed
	if ( conf == NULL ) 
	{
	    cw_log( LOG_ERROR, "unable to find or create requested conference\n" ) ;
	    cw_mutex_unlock( &start_stop_conf_lock ) ;
	    return NULL ;
	}
    }
    else
    {
	// existing conference found, add new member to the conference
	// once we call add_member(), this thread
	// is responsible for calling delete_member()
	//
	add_member( conf, member) ;
    }	

    // release mutex
    cw_mutex_unlock( &start_stop_conf_lock ) ;
    
    return conf ;
}
Пример #5
0
int
main (int argc, char *argv[])
{
    int   fd = -1;
    char *log_identity = argv[0];
    int   log_priority = LOG_INFO;
    int   log_options = LOG_OPT_PRIORITY;

#ifndef NDEBUG
    log_priority = LOG_DEBUG;
    log_options |= LOG_OPT_TIMESTAMP;
#endif /* NDEBUG */
    log_open_file (stderr, log_identity, log_priority, log_options);

    disable_core_dumps ();
    conf = create_conf ();
    parse_cmdline (conf, argc, argv);
    auth_recv_init (conf->auth_server_dir, conf->auth_client_dir,
        conf->got_force);

    if (!conf->got_foreground) {
        fd = daemonize_init (argv[0]);
        if (conf->got_syslog) {
            log_open_file (NULL, NULL, 0, 0);
            log_open_syslog (log_identity, LOG_DAEMON);
        }
        else {
            open_logfile (conf->logfile_name, log_priority, conf->got_force);
        }
    }
    handle_signals ();
    lookup_ip_addr (conf);
    write_pidfile (conf->pidfile_name, conf->got_force);
    if (conf->got_mlockall) {
        lock_memory ();
    }
    crypto_init ();
    if (random_init (conf->seed_name) < 0) {
        if (conf->seed_name) {
            free (conf->seed_name);
            conf->seed_name = NULL;
        }
    }
    create_subkeys (conf);
    conf->gids = gids_create (conf->gids_update_secs, conf->got_group_stat);
    replay_init ();
    timer_init ();
    sock_create (conf);

    if (!conf->got_foreground) {
        daemonize_fini (fd);
    }
    log_msg (LOG_NOTICE, "Starting %s daemon (pid %d)",
        META_ALIAS, (int) getpid ());

    job_accept (conf);

    sock_destroy (conf);
    timer_fini ();
    replay_fini ();
    gids_destroy (conf->gids);
    random_fini (conf->seed_name);
    crypto_fini ();
    destroy_conf (conf);

    log_msg (LOG_NOTICE, "Stopping %s daemon (pid %d)",
        META_ALIAS, (int) getpid ());

    exit (EMUNGE_SUCCESS);
}
Пример #6
0
static void* my_create_dir_conf(apr_pool_t* pool, char* x) {
    return create_conf(pool);
}
Пример #7
0
//Creates the service config struct, not performs filling but could be used to provide default parameters
static void *create_mod_config(apr_pool_t *pool, server_rec *s)
{
    return create_conf(pool);
}