Example #1
0
END_TEST

#undef PATH_TO_CONFIG
#define PATH_TO_CONFIG "test/etc/optimen.conf.incorrect.values"
START_TEST(test_config_with_incorrect_values)
{
	int ret = config_initialize(PATH_TO_CONFIG, false);

	ck_assert_int_eq(ret, -1);

	config_deinitialize();
}
Example #2
0
END_TEST

#undef PATH_TO_CONFIG
#define PATH_TO_CONFIG "test/etc/optimen.conf.noent"
START_TEST(test_config_noent)
{
	int ret = config_initialize(PATH_TO_CONFIG, false);

	ck_assert_int_eq(ret, -1);

	config_deinitialize();
}
Example #3
0
END_TEST

#undef PATH_TO_CONFIG
#define PATH_TO_CONFIG "test/etc/optimen.conf.dups"
START_TEST(test_config_with_duplicate_values)
{
	int ret = config_initialize(PATH_TO_CONFIG, false);

	ck_assert_int_eq(ret, 0);
	ck_assert(check_config_with_dups() == 0);

	config_deinitialize();
}
Example #4
0
END_TEST

#undef PATH_TO_CONFIG
#define PATH_TO_CONFIG "test/etc/optimen.conf.spaces.comments"
START_TEST(test_config_spaces_and_comments)
{
	int ret = config_initialize(PATH_TO_CONFIG, false);

	ck_assert_int_eq(ret, 0);
	ck_assert(check_config_initialized() == 0);

	config_deinitialize();
}
Example #5
0
END_TEST

#undef PATH_TO_CONFIG
#define PATH_TO_CONFIG "test/etc/optimen.conf.empty"
START_TEST(test_config_empty)
{
	int ret = config_initialize(PATH_TO_CONFIG, false);

	ck_assert_int_eq(ret, 0);
	ck_assert(check_config_empty() == 0);

	config_deinitialize();
}
Example #6
0
static void _initialize_subsystems(void)
{
    if (!kitsune_is_updating()) { /**DSU control */
        log_initialize();
        thread_initialize();
        sock_initialize();
        resolver_initialize();
        config_initialize();
        connection_initialize();
        global_initialize();
        refbuf_initialize();
        xslt_initialize();
    }
}
Example #7
0
static void _initialize_subsystems(void)
{
    log_initialize();
    thread_initialize();
    sock_initialize();
    resolver_initialize();
    config_initialize();
    connection_initialize();
    global_initialize();
    refbuf_initialize();
    xslt_initialize();
#ifdef USE_YP
    curl_initialize();
#endif
}
int main(void)
{
    ice_config_t *config;

    config_initialize();
    
    config_parse_file("icecast.xml");

    config = config_get_config_unlocked();

    _dump_config(config);

    config_shutdown();

    return 0;
}
Example #9
0
void initialize_subsystems(void)
{
    log_initialize();
    errorlog = log_open_file (stderr);
    thread_initialize();
    sock_initialize();
    resolver_initialize();
    config_initialize();
    connection_initialize();
    global_initialize();
    refbuf_initialize();

    stats_initialize();
    xslt_initialize();
#ifdef HAVE_CURL_GLOBAL_INIT
    curl_global_init (CURL_GLOBAL_ALL);
#endif
}
Example #10
0
int main(int argc, char **argv)
{
    char logpath[FILENAME_MAX];
    int log;

    if (argc != 2) 
    {
        fprintf(stderr, PACKAGE_STRING "\n"
                "  (c) Copyright 2001-2004 The IceS Development Team <*****@*****.**>\n"
                "        Michael Smith <*****@*****.**>\n"
                "        Karl Heyes    <*****@*****.**>\n"
                "        and others\n"
                "\n"
                "Usage: \"ices config.xml\"\n");
        return 1;
    }

    config_initialize();

    if (config_read(argv[1]) <= 0) 
    {
        fprintf(stderr, "Failed to read config file \"%s\"\n", argv[1]);
        goto fail;
    }
	
    if (ices_config->background)
    {
#ifndef _WIN32		
        int ret = 0;
        /* Start up new session, to lose old session and process group */
        switch (fork())
        {
        case 0: break; /* child continues */
        case -1: perror ("fork"); ret = -1;
        default:
            exit (ret);
        }

        /* Disassociate process group and controlling terminal */ 
        setsid();

        /* Become a NON-session leader so that a */
        /* control terminal can't be reacquired */
        switch (fork())
        {
        case 0: break; /* child continues */
        case -1: perror ("fork"); ret = -1;
        default:
            exit (ret);
        }
#else
        FreeConsole();
#endif    		
    }

    log_initialize();
    thread_initialize();
    shout_init();
    encode_init();
#ifndef _WIN32	
    signals_setup();
#endif

    snprintf(logpath, FILENAME_MAX, "%s/%s", ices_config->logpath, 
            ices_config->logfile);
    if(ices_config->log_stderr)
        log = log_open_file(stderr);
    else
    {
        log = log_open(logpath);
        if (log < 0)
            fprintf (stderr, "unable to open log %s\n", logpath);
        log_set_trigger (log, ices_config->logsize);
    }
    /* Set the log level, if requested - defaults to 2 (WARN) otherwise */
    if (ices_config->loglevel)
        log_set_level(log, ices_config->loglevel);

    ices_config->log_id = log;

    LOG_INFO0(PACKAGE_STRING " started...");
    if (ices_config->pidfile != NULL)
    {
        FILE *f = fopen (ices_config->pidfile, "w");
        if (f)
        {
            fprintf (f, "%i", getpid());
            fclose (f);
        }
        else
        {
            LOG_WARN1("pidfile \"%s\" cannot be written to", ices_config->pidfile);
            xmlFree (ices_config->pidfile);
            ices_config->pidfile = NULL;
        }
    }

    /* Start the core streaming loop */
    input_loop();

    if (ices_config->pidfile)
        remove (ices_config->pidfile);

    LOG_INFO0("Shutdown complete");

    log_close(log);

 fail:
    encode_close();
    shout_shutdown();
    config_shutdown();
    thread_shutdown();
    log_shutdown();

    return 0;
}
Example #11
0
File: main.c Project: 173210/VHL
_start(UVL_Context *ctx)
{
    void * const vhlStubTop = getVhlStubTop();
    void * const vhlPrimaryStubTop = (void *)((uintptr_t)vhlStubTop + 16);
    void * const vhlPrimaryStubBtm = (void *)((uintptr_t)vhlPrimaryStubTop + vhlPrimaryStubSize);

    const SceModuleImports * cachedImports[CACHED_IMPORTED_MODULE_NUM];
    nidTable_entry libkernelBase;
    SceModuleInfo *libkernelInfo;
    SceUID uid;
    void *p;
    int err;

    ctx->logline("Starting VHL...");

    /* It may get wrong if you change the order of nid_table_resolveVhl*
       See stub.S to know what imports will be resolved with those functions. */
    ctx->logline("Resolving VHL puts");
    nid_table_resolveVhlPuts(vhlStubTop, ctx);
    ctx->psvFlushIcache(vhlStubTop, 16);

    DEBUG_LOG_("Searching for SceLibKernel");
    if (nid_table_analyzeStub(ctx->libkernel_anchor, 0, &libkernelBase) != ANALYZE_STUB_OK) {
        DEBUG_LOG_("Failed to find the base of SceLibKernel");
        return -1;
    }

    libkernelBase.value.i = B_UNSET(libkernelBase.value.i, 0);

    libkernelInfo = nid_table_findModuleInfo(libkernelBase.value.p, KERNEL_MODULE_SIZE, "SceLibKernel");
    if (libkernelInfo == NULL) {
        DEBUG_LOG_("Failed to find the module information of SceLibKernel");
        return -1;
    }

    DEBUG_LOG_("Searching for cached imports");
    nidCacheFindCachedImports(libkernelInfo, cachedImports);

    DEBUG_LOG_("Resolving VHL primary imports");
    nid_table_resolveVhlPrimaryImports(vhlPrimaryStubTop, vhlPrimaryStubSize,
                                       libkernelInfo, cachedImports, ctx);
    ctx->psvFlushIcache(vhlPrimaryStubTop, vhlPrimaryStubSize);

    DEBUG_LOG_("Allocating memory for VHL");
    uid = sceKernelAllocMemBlock("vhlGlobals", SCE_KERNEL_MEMBLOCK_TYPE_USER_RW,
                                 FOUR_KB_ALIGN(sizeof(globals_t)), NULL);
    if (uid < 0) {
        DEBUG_LOG("Failed to allocate memory block 0x%08X", uid);
        return uid;
    }

    err = sceKernelGetMemBlockBase(uid, &p);
    if (err < 0) {
        DEBUG_LOG("Failed to retrive memory block 0x%08X", err);
        return uid;
    }

    ctx->psvUnlockMem();
    globals = p;
    ctx->psvLockMem();

    DEBUG_LOG_("Initializing table");
    nid_storage_initialize();

    DEBUG_LOG_("Searching and Adding stubs to table...");
    nid_table_addAllStubs();

    DEBUG_LOG_("Resolving VHL secondary imports");
    nid_table_resolveVhlSecondaryImports(vhlPrimaryStubBtm, vhlSecondaryStubSize,
                                         libkernelInfo, cachedImports, ctx);
    ctx->psvFlushIcache(vhlPrimaryStubBtm, vhlSecondaryStubSize);

    DEBUG_LOG_("Adding stubs to table with cache");
    if (nid_table_addNIDCacheToTable(cachedImports) < 0)
        return -1;

    DEBUG_LOG_("Adding hooks to table");
    nid_table_addAllHooks();

    //TODO find a way to free unused memory

    block_manager_initialize();  //Initialize the elf block slots

    //TODO decide how to handle plugins

    config_initialize();

    DEBUG_LOG_("Loading menu...");

    if(elf_parser_load(globals->allocatedBlocks, "pss0:/top/Documents/homebrew.self", NULL) < 0) {
        internal_printf("Load failed!");
        return -1;
    }
    puts("Load succeeded! Launching!");

    elf_parser_start(globals->allocatedBlocks, 0);

    while(1) {
        //Delay thread and check for flags and things to update every once in a while, check for exit combination
        //calls.LogLine("Menu exited! Relaunching...");
        sceKernelDelayThread(16000);  //Update stuff once every 16 ms
    }

    return 0;
}