diff --git a/src/signal_handler.c b/src/signal_handler.c index 0412d9cfe52dc540a8cc4cbd75bda930eeea05ae..5f7d17b64ebb96d6400d1b9a50d970ef10fcec71 100644 --- a/src/signal_handler.c +++ b/src/signal_handler.c @@ -25,7 +25,7 @@ #include "main.h" #include <signal.h> -RCSID("$Id: signal_handler.c,v 1.153 1999/08/30 21:49:40 hubbe Exp $"); +RCSID("$Id: signal_handler.c,v 1.154 1999/09/11 08:16:48 hubbe Exp $"); #ifdef HAVE_PASSWD_H # include <passwd.h> @@ -2409,6 +2409,39 @@ void f_create_process(INT32 args) /* Wake up the child. */ buf[0] = 0; + + + /* + * This code works, but seems to slow down process creation + * rathern than speed it up. Only tested on Linux. + * /Hubbe + */ +#if 0 + { + int gnapp=0; + while (((e = write(control_pipe[0], buf, 1)) < 0) && (errno == EINTR)) + ; + THREADS_ALLOW(); + if(e!=1) { + /* Paranoia in case close() sets errno. */ + olderrno = errno; + while(close(control_pipe[0]) < 0 && errno==EINTR); + gnapp=1; + } else { + /* Wait for exec or error */ + while (((e = read(control_pipe[0], buf, 3)) < 0) && (errno == EINTR)) + ; + /* Paranoia in case close() sets errno. */ + olderrno = errno; + + while(close(control_pipe[0]) < 0 && errno==EINTR); + } + THREADS_DISALLOW(); + if(gnapp) + error("Child process died prematurely. (e=%d errno=%d)\n", + e ,olderrno); + } +#else while (((e = write(control_pipe[0], buf, 1)) < 0) && (errno == EINTR)) ; if(e!=1) { @@ -2426,6 +2459,8 @@ void f_create_process(INT32 args) olderrno = errno; while(close(control_pipe[0]) < 0 && errno==EINTR); +#endif + if (!e) { /* OK! */