From: Sam S. <sd...@gn...> - 2003-02-13 04:12:59
|
> * In message <Pin...@as...> > * On the subject of "[clisp-list] Re: Issue: SIG_IGN setting for SIGCHLD inherited by children of CLISP." > * Sent on Wed, 12 Feb 2003 16:24:59 -0800 (PST) > * Honorable Kaz Kylheku <ka...@as...> writes: > > The problem with this is that normally, when you run programs from the > shell, they get SIG_DFL, which has different behavior from SIG_IGN. > The exec() system call causes SIG_IGN and SIG_DFL settings to be > inherited by the new process image. > > On Linux, signal(SIGCHLD, SIG_IGN) seems to cause the waitpid() > semantics described by the Single UNIX Specification. If the processes > terminate before the waitpid() call is reached, they are reaped > internally without becoming zombies. Then the waitpid() returns -1 with > ECHILD. If the waitpid is reached while the child is still running, > then waitpid() waits normally and returns the pid. > > This is a problem, because lots of programs---CVS being one > example---are not written to defend against this obscure behavior and so > the -1/ECHILD takes them by surprise; they just expect SIGCHLD to be > SIG_DFL on startup. note that EXECUTE does not suffer from this problem, only pipe functions do. please try the appended patch. -- Sam Steingold (http://www.podval.org/~sds) running RedHat8 GNU/Linux <http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/> <http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html> What garlic is to food, insanity is to art. --- stream.d.~1.339.~ 2003-01-29 14:36:06.000000000 -0500 +++ stream.d 2003-02-12 23:11:29.000000000 -0500 @@ -13467,9 +13473,11 @@ var DYNAMIC_ARRAY(command_data,char,command_length); begin_system_call(); memcpy(command_data,command,command_length); + begin_want_sigcld(); # build pipe: if (!( pipe(handles) ==0)) { - FREE_DYNAMIC_ARRAY(command_data); OS_error(); + FREE_DYNAMIC_ARRAY(command_data); + end_want_sigcld(); OS_error(); } # Everything, that is stuffed in handles[1], resurfaces at handles[0] # again. We will utilize this as follows: @@ -13495,6 +13503,7 @@ _exit(-1); # if this fails, finish child-process } # This piece of code is again executed by the caller: + end_want_sigcld(); if (child==-1) # Something failed, either on vfork or on execl. # In both cases errno was set. @@ -13678,8 +13687,10 @@ var DYNAMIC_ARRAY(command_data,char,command_length); begin_system_call(); memcpy(command_data,command,command_length); + begin_want_sigcld(); if (!( pipe(handles) ==0)) { - FREE_DYNAMIC_ARRAY(command_data); OS_error(); + FREE_DYNAMIC_ARRAY(command_data); + end_want_sigcld(); OS_error(); } # Everything, that is stuffed in handles[1], resurfaces at handles[0] # again. We will utilize this as follows: @@ -13705,6 +13716,7 @@ _exit(-1); # if this fails, finish child-process } # This piece of code is again executed by the caller: + end_want_sigcld(); if (child==-1) # Something failed, either on vfork or on execl. # In both cases errno was set. @@ -13830,11 +13842,14 @@ var DYNAMIC_ARRAY(command_data,char,command_length); begin_system_call(); memcpy(command_data,command,command_length); + begin_want_sigcld(); # build Pipes: if (!( pipe(in_handles) ==0)) { - FREE_DYNAMIC_ARRAY(command_data); OS_error(); + FREE_DYNAMIC_ARRAY(command_data); + end_want_sigcld(); OS_error(); } if (!( pipe(out_handles) ==0)) + end_want_sigcld(); OS_error_saving_errno({ CLOSE(in_handles[1]); CLOSE(in_handles[0]); FREE_DYNAMIC_ARRAY(command_data); @@ -13873,6 +13888,7 @@ _exit(-1); # if this fails, finish child-process } # This piece of code is again executed by the caller: + end_want_sigcld(); if (child==-1) # Something failed, either on vfork or on execl. # In both cases errno was set. |