13 static void ngx_destroy_cycle_pools(
ngx_conf_t *conf);
239 if (conf.
args == NULL) {
264 ngx_destroy_cycle_pools(&conf);
270 ngx_destroy_cycle_pools(&conf);
291 ngx_destroy_cycle_pools(&conf);
356 if (i >= part->
nelts) {
357 if (part->
next == NULL) {
365 if (file[i].name.len == 0) {
376 &file[i], file[i].
fd, file[i].name.
data);
386 if (fcntl(file[i].fd, F_SETFD, FD_CLOEXEC) == -1) {
388 "fcntl(FD_CLOEXEC) \"%s\" failed",
402 shm_zone = part->
elts;
406 if (i >= part->
nelts) {
407 if (part->
next == NULL) {
411 shm_zone = part->
elts;
415 if (shm_zone[i].shm.size == 0) {
417 "zero size shared memory zone \"%V\"",
418 &shm_zone[i].shm.name);
425 oshm_zone = opart->
elts;
429 if (n >= opart->
nelts) {
430 if (opart->
next == NULL) {
434 oshm_zone = opart->
elts;
438 if (shm_zone[i].shm.name.len != oshm_zone[n].
shm.
name.
len) {
450 if (shm_zone[i].tag == oshm_zone[n].tag
451 && shm_zone[i].shm.size == oshm_zone[n].
shm.
size)
455 if (shm_zone[i].init(&shm_zone[i], oshm_zone[n].
data)
473 if (ngx_init_zone_pool(cycle, &shm_zone[i]) !=
NGX_OK) {
477 if (shm_zone[i].init(&shm_zone[i], NULL) !=
NGX_OK) {
505 nls[n].
fd = ls[
i].
fd;
509 if (ls[n].backlog != nls[i].backlog) {
513 #if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
519 nls[n].deferred_accept = ls[
i].deferred_accept;
521 if (ls[i].accept_filter && nls[n].accept_filter) {
523 nls[n].accept_filter)
526 nls[n].delete_deferred = 1;
527 nls[n].add_deferred = 1;
530 }
else if (ls[i].accept_filter) {
531 nls[n].delete_deferred = 1;
533 }
else if (nls[n].accept_filter) {
534 nls[n].add_deferred = 1;
538 #if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
540 if (ls[n].deferred_accept && !nls[n].deferred_accept) {
541 nls[n].delete_deferred = 1;
543 }
else if (ls[i].deferred_accept != nls[n].deferred_accept)
545 nls[n].add_deferred = 1;
552 if (nls[n].
fd == -1) {
561 #if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
562 if (ls[i].accept_filter) {
563 ls[
i].add_deferred = 1;
566 #if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
567 if (ls[i].deferred_accept) {
568 ls[
i].add_deferred = 1;
610 oshm_zone = opart->
elts;
614 if (i >= opart->
nelts) {
615 if (opart->
next == NULL) {
616 goto old_shm_zone_done;
619 oshm_zone = opart->
elts;
624 shm_zone = part->
elts;
628 if (n >= part->
nelts) {
629 if (part->
next == NULL) {
633 shm_zone = part->
elts;
637 if (oshm_zone[i].shm.name.len == shm_zone[n].
shm.
name.
len
662 if (ls[i].remain || ls[i].
fd == -1) {
672 #if (NGX_HAVE_UNIX_DOMAIN)
674 if (ls[i].
sockaddr->sa_family == AF_UNIX) {
680 "deleting socket %s", name);
699 if (i >= part->
nelts) {
700 if (part->
next == NULL) {
741 if (ngx_temp_pool == NULL) {
743 if (ngx_temp_pool == NULL) {
745 "could not create ngx_temp_pool");
752 if (ngx_old_cycles.
elts == NULL) {
755 ngx_old_cycles.
nelts = 0;
757 ngx_old_cycles.
nalloc = n;
758 ngx_old_cycles.
pool = ngx_temp_pool;
760 ngx_cleaner_event.
handler = ngx_clean_old_cycles;
761 ngx_cleaner_event.
log = cycle->
log;
762 ngx_cleaner_event.
data = &dumb;
766 ngx_temp_pool->
log = cycle->
log;
799 if (i >= part->
nelts) {
800 if (part->
next == NULL) {
820 ngx_destroy_cycle_pools(&conf);
826 if (ls[i].
fd == -1 || !ls[i].open) {
837 ngx_destroy_cycle_pools(&conf);
854 struct sockaddr_in *sin1, *sin2;
856 struct sockaddr_in6 *sin61, *sin62;
858 #if (NGX_HAVE_UNIX_DOMAIN)
859 struct sockaddr_un *saun1, *saun2;
862 if (sa1->sa_family != sa2->sa_family) {
866 switch (sa1->sa_family) {
870 sin61 = (
struct sockaddr_in6 *) sa1;
871 sin62 = (
struct sockaddr_in6 *) sa2;
873 if (sin61->sin6_port != sin62->sin6_port) {
877 if (
ngx_memcmp(&sin61->sin6_addr, &sin62->sin6_addr, 16) != 0) {
884 #if (NGX_HAVE_UNIX_DOMAIN)
886 saun1 = (
struct sockaddr_un *) sa1;
887 saun2 = (
struct sockaddr_un *) sa2;
889 if (
ngx_memcmp(&saun1->sun_path, &saun2->sun_path,
890 sizeof(saun1->sun_path))
901 sin1 = (
struct sockaddr_in *) sa1;
902 sin2 = (
struct sockaddr_in *) sa2;
904 if (sin1->sin_port != sin2->sin_port) {
908 if (sin1->sin_addr.s_addr != sin2->sin_addr.s_addr) {
929 if (sp == sp->
addr) {
934 "shared zone \"%V\" has no equal addresses: %p vs %p",
943 #if (NGX_HAVE_ATOMIC_OPS)
1068 while (n-- && (buf[n] ==
CR || buf[n] ==
LF)) { }
1074 "invalid PID number \"%*s\" in \"%s\"",
1085 ngx_test_lockfile(u_char *file,
ngx_log_t *log)
1087 #if !(NGX_HAVE_ATOMIC_OPS)
1126 for (i = 0; ; i++) {
1128 if (i >= part->
nelts) {
1129 if (part->
next == NULL) {
1137 if (file[i].name.len == 0) {
1141 if (file[i].flush) {
1149 "reopen file \"%s\", old:%d new:%d",
1176 if (fi.st_uid != user) {
1177 if (chown((
const char *) file[i].name.
data, user, -1) == -1) {
1179 "chown(\"%s\", %d) failed",
1194 if (chmod((
const char *) file[i].name.
data, fi.st_mode) == -1) {
1196 "chmod() \"%s\" failed", file[i].
name.
data);
1207 if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) {
1209 "fcntl(FD_CLOEXEC) \"%s\" failed",
1236 "dup2(STDERR) failed");
1252 shm_zone = part->
elts;
1254 for (i = 0; ; i++) {
1256 if (i >= part->
nelts) {
1257 if (part->
next == NULL) {
1261 shm_zone = part->
elts;
1275 if (tag != shm_zone[i].tag) {
1277 "the shared memory zone \"%V\" is "
1278 "already declared for a different use",
1279 &shm_zone[i].shm.name);
1283 if (size && size != shm_zone[i].shm.size) {
1285 "the size %uz of shared memory zone \"%V\" "
1286 "conflicts with already declared size %uz",
1287 size, &shm_zone[i].shm.name, shm_zone[i].
shm.
size);
1291 return &shm_zone[
i];
1296 if (shm_zone == NULL) {
1300 shm_zone->
data = NULL;
1305 shm_zone->
init = NULL;
1306 shm_zone->
tag = tag;
1319 log = ngx_cycle->
log;
1320 ngx_temp_pool->
log = log;
1326 cycle = ngx_old_cycles.
elts;
1327 for (i = 0; i < ngx_old_cycles.
nelts; i++) {
1329 if (cycle[i] == NULL) {
1336 if (cycle[i]->connections[n].fd != (
ngx_socket_t) -1) {
1363 ngx_temp_pool = NULL;
1364 ngx_old_cycles.
nelts = 0;