test that zone has the same addresses in different processes

This commit is contained in:
Igor Sysoev 2009-06-02 13:57:59 +00:00
parent 5b26bec9e8
commit a119584e66
2 changed files with 16 additions and 5 deletions

View File

@ -463,12 +463,9 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
goto failed; goto failed;
} }
if (!shm_zone[i].shm.exists) {
if (ngx_init_zone_pool(cycle, &shm_zone[i]) != NGX_OK) { if (ngx_init_zone_pool(cycle, &shm_zone[i]) != NGX_OK) {
goto failed; goto failed;
} }
}
if (shm_zone[i].init(&shm_zone[i], NULL) != NGX_OK) { if (shm_zone[i].init(&shm_zone[i], NULL) != NGX_OK) {
goto failed; goto failed;
@ -885,8 +882,21 @@ ngx_init_zone_pool(ngx_cycle_t *cycle, ngx_shm_zone_t *zn)
sp = (ngx_slab_pool_t *) zn->shm.addr; sp = (ngx_slab_pool_t *) zn->shm.addr;
if (zn->shm.exists) {
if (sp == sp->addr) {
return NGX_OK;
}
ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
"shared zone \"%V\" has no equal addresses: %p vs %p",
&zn->shm.name, sp->addr, sp);
return NGX_ERROR;
}
sp->end = zn->shm.addr + zn->shm.size; sp->end = zn->shm.addr + zn->shm.size;
sp->min_shift = 3; sp->min_shift = 3;
sp->addr = zn->shm.addr;
#if (NGX_HAVE_ATOMIC_OPS) #if (NGX_HAVE_ATOMIC_OPS)

View File

@ -39,6 +39,7 @@ typedef struct {
u_char zero; u_char zero;
void *data; void *data;
void *addr;
} ngx_slab_pool_t; } ngx_slab_pool_t;