[PATCH 1 of 2] chg: document why we send SIGHUP and SIGINT to process group

Jun Wu quark at fb.com
Wed Mar 8 21:47:48 UTC 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1489008865 28800
#      Wed Mar 08 13:34:25 2017 -0800
# Node ID 26c57e0bc4b0d3c78fc0ddf9701d418d70fa0013
# Parent  c32f9eeec75445bfbbc55df4c1fcc584d3cf45cd
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 26c57e0bc4b0
chg: document why we send SIGHUP and SIGINT to process group

This makes the code more consistent - other signals are documented.

diff --git a/contrib/chg/procutil.c b/contrib/chg/procutil.c
--- a/contrib/chg/procutil.c
+++ b/contrib/chg/procutil.c
@@ -92,9 +92,13 @@ void setupsignalhandler(pid_t pid, pid_t
 	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;


More information about the Mercurial-devel mailing list