manoj 99/08/03 17:21:37
Modified: mpm/src/modules/mpm/dexter dexter.c mpm/src/modules/mpm/mpmt_pthread mpmt_pthread.c Log: Undo the stupid pipe of death changes I made earlier today. dean noted that we need an char_of_death array to do this safely, and it's just not worth the effort. The EINTR stuff is left behind, though. Hopefully this is now decent again. Revision Changes Path 1.17 +5 -10 apache-2.0/mpm/src/modules/mpm/dexter/dexter.c Index: dexter.c =================================================================== RCS file: /home/cvs/apache-2.0/mpm/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -u -r1.16 -r1.17 --- dexter.c 1999/08/03 23:43:02 1.16 +++ dexter.c 1999/08/04 00:21:32 1.17 @@ -1404,7 +1404,7 @@ } if (is_graceful) { - int i, bytes_to_write; + int i; char char_of_death = '!'; ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf, @@ -1420,17 +1420,12 @@ } } /* give the children the signal to die */ - /* XXX - This while loop logic should be made into a utility function */ - bytes_to_write = num_daemons; - while (bytes_to_write > 0) { - i = write(pipe_of_death[1], &char_of_death, bytes_to_write); - if (i == -1) { + for (i = 0; i < num_daemons;) { + if (write(pipe_of_death[1], &char_of_death, 1) == -1) { if (errno == EINTR) continue; - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "write pipe_of_death"); - break; + ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "write pipe_of_death"); } - bytes_to_write -= i; + i++; } } else { 1.22 +6 -13 apache-2.0/mpm/src/modules/mpm/mpmt_pthread/mpmt_pthread.c Index: mpmt_pthread.c =================================================================== RCS file: /home/cvs/apache-2.0/mpm/src/modules/mpm/mpmt_pthread/mpmt_pthread.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -u -r1.21 -r1.22 --- mpmt_pthread.c 1999/08/03 23:36:43 1.21 +++ mpmt_pthread.c 1999/08/04 00:21:35 1.22 @@ -1463,26 +1463,19 @@ update_scoreboard_global(); if (is_graceful) { - int i, j, bytes_to_write; + int i, j; char char_of_death = '!'; ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf, "SIGWINCH received. Doing graceful restart"); - /* give the children the signal to die. Sending more bytes than - * children is okay, because the pipe is recreated for every - * generation */ - /* XXX - This while loop logic should be made into a utility function */ - bytes_to_write = ap_daemons_limit; - while (bytes_to_write > 0) { - i = write(pipe_of_death[1], &char_of_death, bytes_to_write); - if (i == -1) { + /* give the children the signal to die */ + for (i = 0; i < ap_daemons_limit;) { + if (write(pipe_of_death[1], &char_of_death, 1) == -1) { if (errno == EINTR) continue; - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, - "write pipe_of_death"); - break; + ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "write pipe_of_death"); } - bytes_to_write -= i; + i++; } /* This is mostly for debugging... so that we know what is still