[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140320094227.14878.96667.stgit@localhost.localdomain>
Date: Thu, 20 Mar 2014 15:12:27 +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 25/33] Systemd Socket ID retrieval
The socket created by systemd, waits for connections. Once it accepts a
connection, it starts the service which handles the request for a dump.
>>From this service, we fetch the socket ID and perform the dump.
This is not functional yet, due to the absence of the sd-daemon.h header file.
For this we need to have the correct version of systemd which has this socket
option enabled.
Signed-off-by: Janani Venkataraman <jananive@...ux.vnet.ibm.com>
---
src/coredump.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/src/coredump.c b/src/coredump.c
index ab120b9..98a7146 100755
--- a/src/coredump.c
+++ b/src/coredump.c
@@ -39,6 +39,9 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <coredump.h>
+#if HAVE_SYSTEMD_SOCKET_SUPPORT
+#include <sd-daemon.h>
+#endif
/* Main Socket */
int socket_fd;
@@ -670,6 +673,35 @@ cleanup:
/* Systemd socket for self dump */
int socket_dump(void)
{
+ int n, ret;
+ char core_file[CORE_FILE_NAME_SZ];
+ struct ucred client_info;
+
+ /* Fetching the Socket ID from systemd */
+ n = sd_listen_fds(0);
+ if (n > 1) {
+ gencore_log("Too many file descriptors received.\n");
+ return -1;
+ } else if (n == 1)
+ new_sock = SD_LISTEN_FDS_START + 0;
+ else
+ return -1;
+
+ /* Receive the message */
+ ret = receive_core_filename(core_file);
+ if (ret)
+ return -1;
+
+ /* Fetch client PID */
+ ret = get_client_pid(&client_info);
+ if (ret)
+ return -1;
+
+ /* Dump process */
+ ret = dump_task(&client_info, core_file);
+ if (ret)
+ return -1;
+
return 0;
}
#endif
--
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