lkml.org 
[lkml]   [2014]   [Mar]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 24/33] Handling SIG TERM of the child
From
Date
We handle SIGTERM on the child, by sending a message to the client and then
closing the socket opened for that connection.

Signed-off-by: Janani Venkataraman <jananive@linux.vnet.ibm.com>
---
src/coredump.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

diff --git a/src/coredump.c b/src/coredump.c
index c0da457..ab120b9 100755
--- a/src/coredump.c
+++ b/src/coredump.c
@@ -501,6 +501,18 @@ int dump_task(struct ucred *client_info, char *core_file)
return 0;
}

+/* Handles signals to the child */
+void sig_handler_service_proc(int sig)
+{
+ if (sig != SIGPIPE)
+ send_reply(EINTR);
+ close(new_sock);
+
+ gencore_log("[%d]: Cleanup done and child exiting.\n", pid_log);
+
+ fflush(fp_log);
+}
+
/* Services requests */
int service_request(void)
{
@@ -508,6 +520,11 @@ int service_request(void)
char core_file[CORE_FILE_NAME_SZ];
struct ucred client_info;

+ /* Handles stopping of the servicing process */
+ signal(SIGTERM, sig_handler_service_proc);
+ signal(SIGSEGV, sig_handler_service_proc);
+ signal(SIGPIPE, sig_handler_service_proc);
+
/* Receive the message */
ret = receive_core_filename(core_file);
if (ret)


\
 
 \ /
  Last update: 2014-03-20 12:01    [W:0.168 / U:1.368 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site