Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Jan 2011 18:10:19 +0200
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Pawel Jakub Dawidek <pjd@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r217308 - head/sbin/hastd
Message-ID:  <20110112161019.GW2518@deviant.kiev.zoral.com.ua>
In-Reply-To: <201101121438.p0CEcHWW092155@svn.freebsd.org>
References:  <201101121438.p0CEcHWW092155@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Wed, Jan 12, 2011 at 02:38:17PM +0000, Pawel Jakub Dawidek wrote:
> Author: pjd
> Date: Wed Jan 12 14:38:17 2011
> New Revision: 217308
> URL: http://svn.freebsd.org/changeset/base/217308
> 
> Log:
>   Add a note that when custom signal handler is installed for a signal,
>   signal action is restored to default in child after fork(2).
>   In this case there is no need to do anything with dummy SIGCHLD handler,
>   because after fork(2) it will be automatically reverted to SIG_IGN.
>   
>   Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
>   MFC after:	3 days
> 
> Modified:
>   head/sbin/hastd/hooks.c
> 
> Modified: head/sbin/hastd/hooks.c
> ==============================================================================
> --- head/sbin/hastd/hooks.c	Wed Jan 12 14:35:29 2011	(r217307)
> +++ head/sbin/hastd/hooks.c	Wed Jan 12 14:38:17 2011	(r217308)
> @@ -372,6 +372,11 @@ hook_execv(const char *path, va_list ap)
>  		descriptors();
>  		PJDLOG_VERIFY(sigemptyset(&mask) == 0);
>  		PJDLOG_VERIFY(sigprocmask(SIG_SETMASK, &mask, NULL) == 0);
> +		/*
> +		 * Dummy handler set for SIGCHLD in the parent should be
> +		 * changed after fork(2) automatically to the default SIG_IGN,
> +		 * so there is no need to do anything with it.
> +		 */
>  		execv(path, args);
>  		pjdlog_errno(LOG_ERR, "Unable to execute %s", path);
>  		exit(EX_SOFTWARE);
Fork does not change the disposition of the signals.
Exec family of the functions indeed reset the signals with handler
to default disposition.

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)

iEYEARECAAYFAk0t0msACgkQC3+MBN1Mb4gFYwCgyqixKqUnmP4KtbIpwoZde1XH
eCgAnRON+ggx3ADWSIDlI9PSwDlKyvFH
=S6XP
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110112161019.GW2518>