changeset 31229:68c94f286e25

chg: document why we send SIGHUP and SIGINT to process group This makes the code more consistent - other signals are documented.
author Jun Wu <quark@fb.com>
date Wed, 08 Mar 2017 13:34:25 -0800
parents 51934fc796c0
children cc37b5a06e32
files contrib/chg/procutil.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/chg/procutil.c	Wed Mar 08 14:29:25 2017 -0800
+++ b/contrib/chg/procutil.c	Wed Mar 08 13:34:25 2017 -0800
@@ -91,11 +91,15 @@
 
 	struct sigaction sa;
 	memset(&sa, 0, sizeof(sa));
+
+	/* deadly signals meant to be sent to a process group:
+	 * - SIGHUP: usually generated by the kernel, when termination of a
+	 *   process causes that process group to become orphaned
+	 * - SIGINT: usually generated by the terminal */
 	sa.sa_handler = forwardsignaltogroup;
 	sa.sa_flags = SA_RESTART;
 	if (sigemptyset(&sa.sa_mask) < 0)
 		goto error;
-
 	if (sigaction(SIGHUP, &sa, NULL) < 0)
 		goto error;
 	if (sigaction(SIGINT, &sa, NULL) < 0)