diff --git a/src/signal_handler.c b/src/signal_handler.c index 9b05795050d2b2c242f5566c50e08c7bffc90eb1..0cb02cf07c62b93a21a1b5c01fd5e08aced41a08 100644 --- a/src/signal_handler.c +++ b/src/signal_handler.c @@ -23,7 +23,7 @@ #include "builtin_functions.h" #include <signal.h> -RCSID("$Id: signal_handler.c,v 1.94 1998/11/29 23:17:32 grubba Exp $"); +RCSID("$Id: signal_handler.c,v 1.95 1999/01/08 08:49:28 hubbe Exp $"); #ifdef HAVE_PASSWD_H # include <passwd.h> @@ -564,7 +564,12 @@ static void f_pid_status_wait(INT32 args) #else #if 1 +#define BUGGY_WAITPID + { +#ifdef BUGGY_WAITPID + int errorcount=0; +#endif int err=0; while(THIS->state == PROCESS_RUNNING) { @@ -573,7 +578,25 @@ static void f_pid_status_wait(INT32 args) pid=THIS->pid; if(err) + { + +#ifdef BUGGY_WAITPID + struct svalue key,*s; + key.type=T_INT; + key.u.integer=pid; + s=low_mapping_lookup(pid_mapping, &key); + if(s && s->type == T_OBJECT || s->u.object == fp->current_object) + { + errorcount++; + if(errorcount==50) + error("Pike lost track of a child, pid=%d, errno=%d.\n",pid,err); + + if(!(errorcount%10)) sleep(1); + } + else +#endif error("Pike lost track of a child, pid=%d, errno=%d.\n",pid,err); + } THREADS_ALLOW(); #ifdef HAVE_WAITPID @@ -1472,6 +1495,8 @@ void f_create_process(INT32 args) buf[0] = 0; while (((e = write(control_pipe[0], buf, 1)) < 0) && (errno == EINTR)) ; + if(e!=1) + error("Child process died prematurely. (e=%d errno=%d)\n",e,errno); /* Wait for exec or error */ while (((e = read(control_pipe[0], buf, 3)) < 0) && (errno == EINTR))