LumieraConfigLookupentry lumiera_config_lookup_insert_default (LumieraConfigLookup self, LumieraConfigitem item) { TRACE (configlookup_dbg, "%s", item->line); REQUIRE (self); REQUIRE (item); REQUIRE (item->key); REQUIRE (item->key_size); const char* key = lumiera_tmpbuf_snprintf (SIZE_MAX, "%.*s", item->key_size, item->key); LumieraConfigLookupentry entry = (LumieraConfigLookupentry)psplay_find (&self->tree, key, 100); if (!entry) entry = (LumieraConfigLookupentry)psplay_insert (&self->tree, &lumiera_config_lookupentry_new (key)->node, 100); ////////////////////////////////////////TICKET #839 check that no 'default' item already exists when inserting a default ////////////////////////////////////////TICKET #839 ...that is, the tail element's parent points to the 'defaults' in config llist_insert_tail (&entry->configitems, &item->lookup); return entry; }
LumieraPlugin lumiera_plugin_load_DYNLIB (const char* name) { TRACE (pluginloader_dbg, "load DYNLIB: %s", name); REQUIRE (name); LumieraPlugin self = lumiera_plugin_new (name); LumieraInterface plugin = NULL; void* handle = dlopen (name, RTLD_LAZY|RTLD_LOCAL); if (handle) { plugin = (LumieraInterface) dlsym (handle, LUMIERA_INTERFACE_DSTRING (lumieraorg__plugin, 0, lumieraorg_plugin)); if (!plugin) LUMIERA_ERROR_SET (pluginloader, PLUGIN_WTF, name); } else LUMIERA_ERROR_SET (pluginloader_dbg, PLUGIN_OPEN, lumiera_tmpbuf_snprintf (4096, "%s: %s", name, dlerror())); return lumiera_plugin_init (self, handle, plugin); }
int lumiera_backend_init (void) { TRACE (backend_dbg); lumiera_mutex_init (&lumiera_filecreate_mutex, "fileaccess", &NOBUG_FLAG (mutex_dbg), NOBUG_CONTEXT); lumiera_resourcecollector_init (); /* hook the resourcecollector into the mpool*/ mpool_malloc_hook = lumiera_malloc; mpool_free_hook = lumiera_free; mpool_init_hook = lumiera_backend_resourcecollector_register_mpool; mpool_destroy_hook = lumiera_backend_resourcecollector_unregister_mpool; /* hook the resourcecollector into the safeclib allocation functions */ lumiera_safeclib_set_resourcecollector (lumiera_resourcecollector_run); PLANNED("The resourcecollector aborts by default when there is no final strategy for recovery, TODO: initiate sane shutdown"); lumiera_threadpool_init (); PLANNED ("hook threadpool into the resourcecollector (maybe in threadpool_init() instead here"); lumiera_filedescriptorregistry_init (); lumiera_backend_pagesize = sysconf(_SC_PAGESIZE); /////////////////////////////////////////////////////////////////////TICKET #838 add config options to override following defaults" const char* filehandles = lumiera_tmpbuf_snprintf (SIZE_MAX, "vault.file.max_handles = %d", /* roughly 2/3 of all available filehandles are managed by the Lumiera Vault */ (sysconf (_SC_OPEN_MAX)-10)*2/3); lumiera_config_setdefault (filehandles); long long max_entries; lumiera_config_number_get ("vault.file.max_handles", &max_entries); lumiera_filehandlecache_new (max_entries); #if SIZE_MAX <= 4294967295UL lumiera_config_setdefault ("vault.mmap.as_limit = 3221225469"); #else lumiera_config_setdefault ("vault.mmap.as_limit = 211106232532992"); #endif struct rlimit as_rlimit; getrlimit (RLIMIT_AS, &as_rlimit); long long as_limit = (long long)as_rlimit.rlim_cur; if (as_rlimit.rlim_cur == RLIM_INFINITY) { lumiera_config_number_get ("vault.mmap.as_limit", &as_limit); } else { INFO (vault, "address space limited to %luMiB", as_rlimit.rlim_cur/1024/1024); } lumiera_mmapcache_new (as_limit); return 0; }