comparison src/core/ngx_cycle.c @ 2716:d5896f6608e8

move zone name from ngx_shm_zone_t to ngx_shm_t to use Win32 shared memory
author Igor Sysoev <igor@sysoev.ru>
date Thu, 16 Apr 2009 19:25:09 +0000
parents 9bcda0da8d36
children 73fe3fe858b9
comparison
equal deleted inserted replaced
2715:a5845475a903 2716:d5896f6608e8
410 } 410 }
411 411
412 if (shm_zone[i].shm.size == 0) { 412 if (shm_zone[i].shm.size == 0) {
413 ngx_log_error(NGX_LOG_EMERG, log, 0, 413 ngx_log_error(NGX_LOG_EMERG, log, 0,
414 "zero size shared memory zone \"%V\"", 414 "zero size shared memory zone \"%V\"",
415 &shm_zone[i].name); 415 &shm_zone[i].shm.name);
416 goto failed; 416 goto failed;
417 } 417 }
418 418
419 if (shm_zone[i].init == NULL) { 419 if (shm_zone[i].init == NULL) {
420 /* unused shared zone */ 420 /* unused shared zone */
435 opart = opart->next; 435 opart = opart->next;
436 oshm_zone = opart->elts; 436 oshm_zone = opart->elts;
437 n = 0; 437 n = 0;
438 } 438 }
439 439
440 if (shm_zone[i].name.len != oshm_zone[n].name.len) { 440 if (shm_zone[i].shm.name.len != oshm_zone[n].shm.name.len) {
441 continue; 441 continue;
442 } 442 }
443 443
444 if (ngx_strncmp(shm_zone[i].name.data, oshm_zone[n].name.data, 444 if (ngx_strncmp(shm_zone[i].shm.name.data,
445 shm_zone[i].name.len) 445 oshm_zone[n].shm.name.data,
446 shm_zone[i].shm.name.len)
446 != 0) 447 != 0)
447 { 448 {
448 continue; 449 continue;
449 } 450 }
450 451
670 part = part->next; 671 part = part->next;
671 shm_zone = part->elts; 672 shm_zone = part->elts;
672 n = 0; 673 n = 0;
673 } 674 }
674 675
675 if (oshm_zone[i].name.len == shm_zone[n].name.len 676 if (oshm_zone[i].shm.name.len == shm_zone[n].shm.name.len
676 && ngx_strncmp(oshm_zone[i].name.data, 677 && ngx_strncmp(oshm_zone[i].shm.name.data,
677 shm_zone[n].name.data, 678 shm_zone[n].shm.name.data,
678 oshm_zone[i].name.len) 679 oshm_zone[i].shm.name.len)
679 == 0) 680 == 0)
680 { 681 {
681 goto live_shm_zone; 682 goto live_shm_zone;
682 } 683 }
683 } 684 }
1173 part = part->next; 1174 part = part->next;
1174 shm_zone = part->elts; 1175 shm_zone = part->elts;
1175 i = 0; 1176 i = 0;
1176 } 1177 }
1177 1178
1178 if (name->len != shm_zone[i].name.len) { 1179 if (name->len != shm_zone[i].shm.name.len) {
1179 continue; 1180 continue;
1180 } 1181 }
1181 1182
1182 if (ngx_strncmp(name->data, shm_zone[i].name.data, name->len) != 0) { 1183 if (ngx_strncmp(name->data, shm_zone[i].shm.name.data, name->len)
1184 != 0)
1185 {
1183 continue; 1186 continue;
1184 } 1187 }
1185 1188
1186 if (size && size != shm_zone[i].shm.size) { 1189 if (size && size != shm_zone[i].shm.size) {
1187 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 1190 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
1188 "the size %uz of shared memory zone \"%V\" " 1191 "the size %uz of shared memory zone \"%V\" "
1189 "conflicts with already declared size %uz", 1192 "conflicts with already declared size %uz",
1190 size, &shm_zone[i].name, shm_zone[i].shm.size); 1193 size, &shm_zone[i].shm.name, shm_zone[i].shm.size);
1191 return NULL; 1194 return NULL;
1192 } 1195 }
1193 1196
1194 if (tag != shm_zone[i].tag) { 1197 if (tag != shm_zone[i].tag) {
1195 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 1198 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
1196 "the shared memory zone \"%V\" is " 1199 "the shared memory zone \"%V\" is "
1197 "already declared for a different use", 1200 "already declared for a different use",
1198 &shm_zone[i].name); 1201 &shm_zone[i].shm.name);
1199 return NULL; 1202 return NULL;
1200 } 1203 }
1201 1204
1202 return &shm_zone[i]; 1205 return &shm_zone[i];
1203 } 1206 }
1209 } 1212 }
1210 1213
1211 shm_zone->data = NULL; 1214 shm_zone->data = NULL;
1212 shm_zone->shm.log = cf->cycle->log; 1215 shm_zone->shm.log = cf->cycle->log;
1213 shm_zone->shm.size = size; 1216 shm_zone->shm.size = size;
1217 shm_zone->shm.name = *name;
1214 shm_zone->init = NULL; 1218 shm_zone->init = NULL;
1215 shm_zone->name = *name;
1216 shm_zone->tag = tag; 1219 shm_zone->tag = tag;
1217 1220
1218 return shm_zone; 1221 return shm_zone;
1219 } 1222 }
1220 1223