chg: forward user-defined signals
authorJun Wu <quark@fb.com>
Wed, 08 Mar 2017 13:46:26 -0800
changeset 31230 cc37b5a06e32
parent 31229 68c94f286e25
child 31231 0a38a313033e
chg: forward user-defined signals SIGUSR1 and SIGUSR2 are reserved for user-defined behaviors. They may be redefined by an hg extension [1], but cannot be easily redefined for chg. Since the default behavior (kill) is not that useful for chg, let's forward them to hg, hoping it got redefined there and could be more useful. [1] https://bitbucket.org/facebook/hg-experimental/commits/e7c883a465
contrib/chg/procutil.c
--- a/contrib/chg/procutil.c	Wed Mar 08 13:34:25 2017 -0800
+++ b/contrib/chg/procutil.c	Wed Mar 08 13:46:26 2017 -0800
@@ -115,6 +115,11 @@
 	sa.sa_flags = SA_RESTART;
 	if (sigaction(SIGWINCH, &sa, NULL) < 0)
 		goto error;
+	/* forward user-defined signals */
+	if (sigaction(SIGUSR1, &sa, NULL) < 0)
+		goto error;
+	if (sigaction(SIGUSR2, &sa, NULL) < 0)
+		goto error;
 	/* propagate job control requests to worker */
 	sa.sa_handler = forwardsignal;
 	sa.sa_flags = SA_RESTART;