static int dosdetector_post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) { void *user_data; apr_pool_userdata_get(&user_data, USER_DATA_KEY, s->process->pool); if (user_data == NULL) { apr_pool_userdata_set((const void *)(1), USER_DATA_KEY, apr_pool_cleanup_null, s->process->pool); return OK; } apr_status_t rv = create_shm(s, p); if(rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, "failed to create shared memory"); return HTTP_INTERNAL_SERVER_ERROR; } apr_pool_cleanup_register(p, NULL, cleanup_shm, apr_pool_cleanup_null); rv = ap_global_mutex_create(&lock, NULL, mutex_id, NULL, s, p, 0); if(rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, "failed to create global mutex"); return HTTP_INTERNAL_SERVER_ERROR; } #ifdef _DEBUG const char *mutex_name = apr_global_mutex_name(lock); DEBUGLOG("mutex name is %s", mutex_name); const char *mutex_filename = apr_global_mutex_lockfile(lock); DEBUGLOG("mutex filename is %s", mutex_filename); #endif apr_pool_cleanup_register(p, NULL, cleanup_mutex, apr_pool_cleanup_null); return OK; }
bool PostConfigureGlobalStorage (APRGlobalStorage *storage_p, apr_pool_t *server_pool_p, server_rec *server_p, const char *provider_name_s, struct ap_socache_hints *cache_hints_p) { apr_status_t res; bool success_flag = true; /* * Have we got a valid set of config directives? */ if (storage_p -> ags_socache_provider_p) { /* We have socache_provider, but do not have socache_instance. This should * happen only when using "default" socache_provider, so create default * socache_instance in this case. */ if (! (storage_p -> ags_socache_instance_p)) { const char *err_msg_s = storage_p -> ags_socache_provider_p -> create (& (storage_p -> ags_socache_instance_p), NULL, server_pool_p, server_pool_p); if (err_msg_s) { PrintErrors (STM_LEVEL_SEVERE, __FILE__, __LINE__, "failed to create mod_socache_shmcb socache instance: %s", err_msg_s); success_flag = false; } } if (success_flag) { res = ap_global_mutex_create (& (storage_p -> ags_mutex_p), NULL, storage_p -> ags_cache_id_s, NULL, server_p, server_pool_p, 0); if (res == APR_SUCCESS) { res = storage_p -> ags_socache_provider_p -> init (storage_p -> ags_socache_instance_p, storage_p -> ags_cache_id_s, cache_hints_p, server_p, server_pool_p); if (res != APR_SUCCESS) { PrintErrors (STM_LEVEL_SEVERE, __FILE__, __LINE__, "Failed to initialise %s cache", storage_p -> ags_cache_id_s); success_flag = false; } } else { PrintErrors (STM_LEVEL_SEVERE, __FILE__, __LINE__, "failed to create %s mutex", storage_p -> ags_cache_id_s); success_flag = false; } } } else { PrintErrors (STM_LEVEL_SEVERE, __FILE__, __LINE__, "Please select a socache provider with AuthnCacheSOCache (no default found on this platform). Maybe you need to load mod_socache_shmcb or another socache module first"); success_flag = false; } return success_flag; }