comparison src/os/unix/ngx_process_cycle.c @ 355:0fb6c53fb135

nginx-0.0.7-2004-06-15-21:47:16 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 15 Jun 2004 17:47:16 +0000
parents eaf1f651cf86
children e260514b9ad4
comparison
equal deleted inserted replaced
354:eaf1f651cf86 355:0fb6c53fb135
525 exit(2); 525 exit(2);
526 } 526 }
527 } 527 }
528 } 528 }
529 529
530 for (n = 0; n < ngx_last_process; n++) { 530 for (n = 0; n <= ngx_last_process; n++) {
531 531
532 ngx_log_debug1(NGX_LOG_DEBUG_CORE, cycle->log, 0, 532 if (n == ngx_current_slot) {
533 "close channel %d", ngx_processes[n].channel[1]); 533 if (close(ngx_processes[n].channel[0]) == -1) {
534 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
535 "close() failed");
536 }
537
538 continue;
539 }
534 540
535 if (close(ngx_processes[n].channel[1]) == -1) { 541 if (close(ngx_processes[n].channel[1]) == -1) {
536 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, 542 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
537 "close() failed"); 543 "close() failed");
538 } 544 }
539 }
540
541 if (close(ngx_processes[ngx_last_process].channel[0]) == -1) {
542 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
543 "close() failed");
544 } 545 }
545 546
546 #if 0 547 #if 0
547 ngx_last_process = 0; 548 ngx_last_process = 0;
548 #endif 549 #endif
735 if (ch->fd == -1) { 736 if (ch->fd == -1) {
736 msg.msg_control = NULL; 737 msg.msg_control = NULL;
737 msg.msg_controllen = 0; 738 msg.msg_controllen = 0;
738 739
739 } else { 740 } else {
740 msg.msg_control = &cm; 741 msg.msg_control = (caddr_t) &cm;
741 msg.msg_controllen = sizeof(struct cmsghdr) + sizeof(int); 742 msg.msg_controllen = sizeof(struct cmsghdr) + sizeof(int);
742 743
743 cm.cmsg_len = sizeof(struct cmsghdr) + sizeof(int); 744 cm.cmsg_len = sizeof(struct cmsghdr) + sizeof(int);
744 cm.cmsg_level = SOL_SOCKET; 745 cm.cmsg_level = SOL_SOCKET;
745 cm.cmsg_type = SCM_RIGHTS; 746 cm.cmsg_type = SCM_RIGHTS;
800 msg.msg_namelen = 0; 801 msg.msg_namelen = 0;
801 msg.msg_iov = iov; 802 msg.msg_iov = iov;
802 msg.msg_iovlen = 1; 803 msg.msg_iovlen = 1;
803 804
804 #if (HAVE_MSGHDR_MSG_CONTROL) 805 #if (HAVE_MSGHDR_MSG_CONTROL)
805 msg.msg_control = &cm; 806 msg.msg_control = (caddr_t) &cm;
806 msg.msg_controllen = sizeof(struct cmsghdr) + sizeof(int); 807 msg.msg_controllen = sizeof(struct cmsghdr) + sizeof(int);
807 #else 808 #else
808 msg.msg_accrights = (caddr_t) &fd; 809 msg.msg_accrights = (caddr_t) &fd;
809 msg.msg_accrightslen = sizeof(int); 810 msg.msg_accrightslen = sizeof(int);
810 #endif 811 #endif
828 } 829 }
829 830
830 #if (HAVE_MSGHDR_MSG_CONTROL) 831 #if (HAVE_MSGHDR_MSG_CONTROL)
831 832
832 if (ch->command == NGX_CMD_OPEN_CHANNEL) { 833 if (ch->command == NGX_CMD_OPEN_CHANNEL) {
833 cm = msg.msg_control; 834 cm = (struct cmsghdr *) msg.msg_control;
834 835
835 if (cm == NULL) { 836 if (cm == NULL) {
836 ngx_log_error(NGX_LOG_ALERT, log, 0, 837 ngx_log_error(NGX_LOG_ALERT, log, 0,
837 "recvmsg() returned no ancillary data"); 838 "recvmsg() returned no ancillary data");
838 return NGX_ERROR; 839 return NGX_ERROR;