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 23/33] Handling SIG TERM of the daemon
From
Date
We handle SIGTERM on the daemon, by closing the socket opened for that
connection.

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

diff --git a/src/coredump.c b/src/coredump.c
index 72ba8d8..c0da457 100755
--- a/src/coredump.c
+++ b/src/coredump.c
@@ -562,6 +562,17 @@ int handle_request(void)
return 0;
}

+/* Handles Signals to the Daemon */
+void sig_daemon_handler(int sig)
+{
+ close(socket_fd);
+ unlink(SOCKET_PATH);
+
+ gencore_log("[%d]: Cleanup done and daemon exiting.\n", pid_log);
+
+ fclose(fp_log);
+}
+
/* Daemon for self dump */
int daemon_dump(void)
{
@@ -602,6 +613,11 @@ int daemon_dump(void)
/* SIGCHILD - Signal handler */
signal(SIGCHLD, sigchild_handler);

+ /* Terminate Daemon - signal handler */
+ signal(SIGTERM, sig_daemon_handler);
+ signal(SIGSEGV, sig_daemon_handler);
+ signal(SIGPIPE, sig_daemon_handler);
+
while (1) {

/* Blocks on request */


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