[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140320094210.14878.75209.stgit@localhost.localdomain>
Date: Thu, 20 Mar 2014 15:12:10 +0530
From: Janani Venkataraman <jananive@...ux.vnet.ibm.com>
To: linux-kernel@...r.kernel.org
Cc: amwang@...hat.com, procps@...elists.org, rdunlap@...otime.net,
james.hogan@...tec.com, aravinda@...ux.vnet.ibm.com, hch@....de,
mhiramat@...hat.com, jeremy.fitzhardinge@...rix.com,
xemul@...allels.com, d.hatayama@...fujitsu.com, coreutils@....org,
kosaki.motohiro@...fujitsu.com, adobriyan@...il.com,
util-linux@...r.kernel.org, tarundsk@...ux.vnet.ibm.com,
vapier@...too.org, roland@...k.frob.com, ananth@...ux.vnet.ibm.com,
gorcunov@...nvz.org, avagin@...nvz.org, oleg@...hat.com,
eparis@...hat.com, suzuki@...ux.vnet.ibm.com, andi@...stfloor.org,
tj@...nel.org, akpm@...ux-foundation.org,
torvalds@...ux-foundation.org
Subject: [PATCH 23/33] Handling SIG TERM of the daemon
We handle SIGTERM on the daemon, by closing the socket opened for that
connection.
Signed-off-by: Janani Venkataraman <jananive@...ux.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 */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists