MCPcopy Create free account
hub / github.com/apache/httpd / lua_post_config

Function lua_post_config

modules/lua/mod_lua.c:2024–2062  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2022}
2023
2024static int lua_post_config(apr_pool_t *pconf, apr_pool_t *plog,
2025 apr_pool_t *ptemp, server_rec *s)
2026{
2027 apr_pool_t **pool;
2028 apr_status_t rs;
2029
2030 if (ap_state_query(AP_SQ_MAIN_STATE) == AP_SQ_MS_CREATE_PRE_CONFIG)
2031 return OK;
2032
2033 /* Create ivm mutex */
2034 rs = ap_global_mutex_create(&lua_ivm_mutex, NULL, "lua-ivm-shm", NULL,
2035 s, pconf, 0);
2036 if (APR_SUCCESS != rs) {
2037 return HTTP_INTERNAL_SERVER_ERROR;
2038 }
2039
2040 /* Create shared memory space, anonymous first if possible. */
2041 rs = apr_shm_create(&lua_ivm_shm, sizeof pool, NULL, pconf);
2042 if (APR_STATUS_IS_ENOTIMPL(rs)) {
2043 /* Fall back to filename-based; nuke any left-over first. */
2044 lua_ivm_shmfile = ap_runtime_dir_relative(pconf, DEFAULT_LUA_SHMFILE);
2045
2046 apr_shm_remove(lua_ivm_shmfile, pconf);
2047
2048 rs = apr_shm_create(&lua_ivm_shm, sizeof pool, lua_ivm_shmfile, pconf);
2049 }
2050 if (rs != APR_SUCCESS) {
2051 ap_log_error(APLOG_MARK, APLOG_ERR, rs, s, APLOGNO(02665)
2052 "mod_lua: Failed to create shared memory segment on file %s",
2053 lua_ivm_shmfile ? lua_ivm_shmfile : "(anonymous)");
2054 return HTTP_INTERNAL_SERVER_ERROR;
2055 }
2056 pool = (apr_pool_t **)apr_shm_baseaddr_get(lua_ivm_shm);
2057 apr_pool_create(pool, pconf);
2058 apr_pool_tag(*pool, "mod_lua-shared");
2059 apr_pool_cleanup_register(pconf, NULL, shm_cleanup_wrapper,
2060 apr_pool_cleanup_null);
2061 return OK;
2062}
2063static void *overlay_hook_specs(apr_pool_t *p,
2064 const void *key,
2065 apr_ssize_t klen,

Callers

nothing calls this directly

Calls 4

ap_state_queryFunction · 0.85
ap_global_mutex_createFunction · 0.85
ap_runtime_dir_relativeFunction · 0.85
ap_log_errorFunction · 0.50

Tested by

no test coverage detected