aboutsummaryrefslogtreecommitdiffstats
path: root/erts/etc/common/heart.c
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2015-04-24 14:48:11 +0200
committerBjörn-Egil Dahlberg <[email protected]>2015-04-24 14:48:11 +0200
commite8bb08d1332e7d3a2f41caa15f4155920325e2ac (patch)
tree52148e6cf1e8647750c5bddb49902ca8287f9bbb /erts/etc/common/heart.c
parent8dbdc21b25adc3a0ada29b26823fb9b89d603f23 (diff)
parenta75a12e96596bb0af906a4ac303dd04584c22cf0 (diff)
downloadotp-e8bb08d1332e7d3a2f41caa15f4155920325e2ac.tar.gz
otp-e8bb08d1332e7d3a2f41caa15f4155920325e2ac.tar.bz2
otp-e8bb08d1332e7d3a2f41caa15f4155920325e2ac.zip
Merge branch 'egil/core-on-heart-tmo/OTP-12613'
* egil/core-on-heart-tmo/OTP-12613: kernel: Document heart environment HEART_KILL_SIGNAL erts: Enable different abort signal from heart
Diffstat (limited to 'erts/etc/common/heart.c')
-rw-r--r--erts/etc/common/heart.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/erts/etc/common/heart.c b/erts/etc/common/heart.c
index a4f34e21d0..0d1dcacf2c 100644
--- a/erts/etc/common/heart.c
+++ b/erts/etc/common/heart.c
@@ -117,11 +117,12 @@
#define HEART_COMMAND_ENV "HEART_COMMAND"
#define ERL_CRASH_DUMP_SECONDS_ENV "ERL_CRASH_DUMP_SECONDS"
+#define HEART_KILL_SIGNAL "HEART_KILL_SIGNAL"
-#define MSG_HDR_SIZE 2
-#define MSG_HDR_PLUS_OP_SIZE 3
-#define MSG_BODY_SIZE 2048
-#define MSG_TOTAL_SIZE 2050
+#define MSG_HDR_SIZE (2)
+#define MSG_HDR_PLUS_OP_SIZE (3)
+#define MSG_BODY_SIZE (2048)
+#define MSG_TOTAL_SIZE (2050)
unsigned char cmd[MSG_BODY_SIZE];
@@ -555,14 +556,22 @@ kill_old_erlang(void){
static void
kill_old_erlang(void){
pid_t pid;
- int i;
- int res;
+ int i, res;
+ int sig = SIGKILL;
+ char *sigenv = NULL;
+
+ sigenv = get_env(HEART_KILL_SIGNAL);
+ if (sigenv && strcmp(sigenv, "SIGABRT") == 0) {
+ print_error("kill signal SIGABRT requested");
+ sig = SIGABRT;
+ }
+
if(heart_beat_kill_pid != 0){
pid = (pid_t) heart_beat_kill_pid;
- res = kill(pid,SIGKILL);
+ res = kill(pid,sig);
for(i=0; i < 5 && res == 0; ++i){
sleep(1);
- res = kill(pid,SIGKILL);
+ res = kill(pid,sig);
}
if(errno != ESRCH){
print_error("Unable to kill old process, "