SIGCHLD SIG_IGN, then wait - warning messages

jw schultz jw at pegasys.ws
Fri Jul 25 06:42:07 EST 2003


On Thu, Jul 24, 2003 at 12:27:04PM -0700, Wayne Davison wrote:
> On Thu, Jul 24, 2003 at 09:09:48AM -0400, Hardy Merrill wrote:
> > What is the status on this?
> 
> I finally educated myself on this issue, and would like to propose a
> patch.  Since there are reports that zombies can get created when using
> SIG_IGN on FreeBSD as well as other unices, I think we should change the
> code to catch the signal and cleanup the zombies in the signal handler.
> This would make the code similar to the handling in main.c.
> 
> ..wayne..

Something along these lines might be appropriate.  I did a
little more digging as a result of your message here and it
looks like this routine should either be setting up it's own signal
handler or integrate with wait_process and the signal hander
in main().  Repeatedly setting SICHGLD to SIG_IGN is dumb.

> --- socket.c	27 Jan 2003 03:35:09 -0000	1.84
> +++ socket.c	24 Jul 2003 19:25:05 -0000
> @@ -374,6 +374,14 @@
>  }
>  
>  
> +static RETSIGTYPE sigchld_handler(int UNUSED(val)) {
> +	signal(SIGCHLD, sigchld_handler);
> +#ifdef WNOHANG
> +	while (waitpid(-1, NULL, WNOHANG) > 0) {}
> +#endif
> +}
> +
> +
>  void start_accept_loop(int port, int (*fn)(int, int))
>  {
>  	int s;
> @@ -419,14 +427,7 @@
>  
>  		if (fd == -1) continue;
>  
> -		signal(SIGCHLD, SIG_IGN);
> -
> -		/* we shouldn't have any children left hanging around
> -		   but I have had reports that on Digital Unix zombies
> -		   are produced, so this ensures that they are reaped */
> -#ifdef WNOHANG
> -                while (waitpid(-1, NULL, WNOHANG) > 0);
> -#endif
> +		signal(SIGCHLD, sigchld_handler);
>  
>  		if ((pid = fork()) == 0) {
>  			int ret;

> -- 
> To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
> Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

-- 
________________________________________________________________
	J.W. Schultz            Pegasystems Technologies
	email address:		jw at pegasys.ws

		Remember Cernan and Schmitt



More information about the rsync mailing list