Permalink
Browse files

Regenerate shared memory pointers in child processes

Inspired by mod_shm_counter

Signed-off-by: Michał Pokrywka <michal.pokrywka@gmail.com>
  • Loading branch information...
1 parent 36f0b2d commit 29becc82fa337c400d81be6b7fbecf1696520a0c @mpokrywka mpokrywka committed Feb 28, 2011
Showing with 13 additions and 0 deletions.
  1. +13 −0 mod_upload_progress.c
View
@@ -745,6 +745,19 @@ static void upload_progress_child_init(apr_pool_t *p, server_rec *s)
"Failed to initialise global mutex %s in child process %"
APR_PID_T_FMT ".", config->lock_file, getpid());
}
+
+ if (!config->cache_shm) {
+ rv = apr_shm_attach(&config->cache_shm, config->cache_file, p);
+ if (rv != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s, "Failed to attach to "
+ "shared memory file '%s'", config->cache_file);
+ return;
+ }
+ }
+
+ config->cache = (upload_progress_cache_t *)apr_shm_baseaddr_get(config->cache_shm);
+ config->list = (int *)(config->cache + 1);
+ config->nodes = (upload_progress_node_t *)(config->list + config->cache->count);
}
static const command_rec upload_progress_cmds[] =

0 comments on commit 29becc8

Please sign in to comment.