[4/4] xenstored logging: add minios variant of default_xprintf()
diff mbox series

Message ID 20191204092739.18177-5-james-xen@dingwall.me.uk
State New, archived
Headers show
Series
  • xenstore domain: improve logging capabilities
Related show

Commit Message

james-xen@dingwall.me.uk Dec. 4, 2019, 9:27 a.m. UTC
From: James Dingwall <james@dingwall.me.uk>

stderr is not available in a xenstore domain.  Add a new implementation of
default_xprintf() which sends the message to vsyslog() at LOG_ERROR.
---
 tools/xenstore/utils.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Patch
diff mbox series

diff --git a/tools/xenstore/utils.c b/tools/xenstore/utils.c
index a1ac12584a..7ed05b1970 100644
--- a/tools/xenstore/utils.c
+++ b/tools/xenstore/utils.c
@@ -8,8 +8,21 @@ 
 #include <fcntl.h>
 #include <sys/types.h>
 #include <signal.h>
+#ifdef __MINIOS__
+#include <syslog.h>
+#endif
 #include "utils.h"
 
+#ifdef __MINIOS__
+static void default_xprintf(const char *fmt, ...)
+{
+	va_list args;
+
+	va_start(args, fmt);
+	vsyslog(LOG_ERR, fmt, args);
+	va_end(args);
+}
+#else
 static void default_xprintf(const char *fmt, ...)
 {
 	va_list args;
@@ -19,6 +32,7 @@  static void default_xprintf(const char *fmt, ...)
 	va_end(args);
 	fflush(stderr);
 }
+#endif
 
 void (*xprintf)(const char *fmt, ...) = default_xprintf;