[lxc-devel] [lxc/master] monitor: add more logging

brauner on Github lxc-bot at linuxcontainers.org
Sat Nov 26 06:43:46 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 496 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20161126/b4ee1d9c/attachment.bin>
-------------- next part --------------
From aec1ea6261f6ca6ba34c6d4f3f2ae81a8f0e6069 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Sat, 26 Nov 2016 07:40:59 +0100
Subject: [PATCH] monitor: add more logging

Execing lxc-monitord is quite a crucial step so let's be very obsessive about
logging possible errors to guide us in debugging.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/monitor.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/lxc/monitor.c b/src/lxc/monitor.c
index 1afaa5a..793fbde 100644
--- a/src/lxc/monitor.c
+++ b/src/lxc/monitor.c
@@ -349,18 +349,23 @@ int lxc_monitord_spawn(const char *lxcpath)
 	}
 
 	lxc_check_inherited(NULL, true, pipefd[1]);
-	if (null_stdfds() < 0)
+	if (null_stdfds() < 0) {
+		SYSERROR("Failed to dup2() standard file descriptors to /dev/null.");
 		exit(EXIT_FAILURE);
+	}
 
 	close(pipefd[0]);
 
 	ret = snprintf(pipefd_str, __INT_LEN, "%d", pipefd[1]);
-	if (ret < 0 || ret >= __INT_LEN)
+	if (ret < 0 || ret >= __INT_LEN) {
+		ERROR("Failed to create pid argument to pass to monitord.");
 		exit(EXIT_FAILURE);
+	}
 
 	DEBUG("Using pipe file descriptor %d for monitord.", pipefd[1]);
 
 	execvp(args[0], args);
+	ERROR("Failed to exec lxc-monitord.");
 
 	exit(EXIT_FAILURE);
 }


More information about the lxc-devel mailing list