ben 96/07/17 16:20:52
Modified: src CHANGES conf.h http_main.c Log: Work around broken wait() behaviour in Irix (and perhaps others). Revision Changes Path 1.44 +4 -0 apache/src/CHANGES Index: CHANGES =================================================================== RCS file: /export/home/cvs/apache/src/CHANGES,v retrieving revision 1.43 retrieving revision 1.44 diff -C3 -r1.43 -r1.44 *** CHANGES 1996/07/17 08:33:40 1.43 --- CHANGES 1996/07/17 23:20:47 1.44 *************** *** 6,11 **** --- 6,15 ---- *) Graceful restart code added. This allows the server to restart without losing current connections on receipt of signal 2 (SIGINT). [Ben Laurie] + *) Added BROKEN_WAIT flag to conf.h, to be used on systems which fail to + reap their children correctly (symptom: mod_status shows children which + don't exist). [Ben Laurie] + Changes with Apache 1.1.1: *) Fixed bug where Cookie module would make two entries in the 1.22 +1 -0 apache/src/conf.h Index: conf.h =================================================================== RCS file: /export/home/cvs/apache/src/conf.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C3 -r1.21 -r1.22 *** conf.h 1996/07/17 15:09:58 1.21 --- conf.h 1996/07/17 23:20:49 1.22 *************** *** 94,99 **** --- 94,100 ---- #define HAVE_SHMGET #define HAVE_CRYPT_H #define NO_LONG_DOUBLE + #define BROKEN_WAIT #elif defined(HPUX) || defined(HPUX10) #define HAVE_RESOURCE 1.51 +29 -2 apache/src/http_main.c Index: http_main.c =================================================================== RCS file: /export/home/cvs/apache/src/http_main.c,v retrieving revision 1.50 retrieving revision 1.51 diff -C3 -r1.50 -r1.51 *** http_main.c 1996/07/16 22:14:54 1.50 --- http_main.c 1996/07/17 23:20:50 1.51 *************** *** 937,945 **** #endif } int wait_or_timeout (int *status) { ! wait_or_timeout_retval = -1; #if defined(NEXT) if (setjmp(wait_timeout_buf) != 0) { --- 937,966 ---- #endif } + #ifdef BROKEN_WAIT + /* + Some systems appear to fail to deliver dead children to wait() at times. + This sorts them out. + */ + void reap_children() + { + int status,n; + + for(n=0 ; n < HARD_SERVER_LIMIT ; ++n) + if(scoreboard_image->servers[n].status != SERVER_DEAD + && waitpid(scoreboard_image->servers[n].pid,&status,WNOHANG) == -1 + && errno == ECHILD) + { + sync_scoreboard_image(); + update_child_status(n,SERVER_DEAD,NULL); + } + } + #endif + int wait_or_timeout (int *status) { ! int wait_or_timeout_retval = -1; ! static int ntimes; #if defined(NEXT) if (setjmp(wait_timeout_buf) != 0) { *************** *** 949,955 **** errno = ETIMEDOUT; return wait_or_timeout_retval; } ! signal (SIGALRM, longjmp_out_of_alarm); alarm(1); #if defined(NEXT) --- 970,982 ---- errno = ETIMEDOUT; return wait_or_timeout_retval; } ! #ifdef BROKEN_WAIT ! if(++ntimes == 60) ! { ! reap_children(); ! ntimes=0; ! } ! #endif signal (SIGALRM, longjmp_out_of_alarm); alarm(1); #if defined(NEXT)