diff mbox series

[2/4] xenstored logging: add control to dynamically toggle tracesyslog flag

Message ID 20191204092739.18177-3-james-xen@dingwall.me.uk (mailing list archive)
State New, archived
Headers show
Series xenstore domain: improve logging capabilities | expand

Commit Message

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

Add a new xenstore control command which allows the tracesyslog boolean to be
changed at run time.
---
 tools/xenstore/xenstored_control.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
diff mbox series

Patch

diff --git a/tools/xenstore/xenstored_control.c b/tools/xenstore/xenstored_control.c
index e4b8aa95ab..120dc3aa98 100644
--- a/tools/xenstore/xenstored_control.c
+++ b/tools/xenstore/xenstored_control.c
@@ -76,6 +76,23 @@  static int do_control_logfile(void *ctx, struct connection *conn,
 	return 0;
 }
 
+static int do_control_logsyslog(void *ctx, struct connection *conn,
+			  char **vec, int num)
+{
+	if (num != 1)
+		return EINVAL;
+
+	if (!strcmp(vec[0], "on"))
+		tracesyslog = true;
+	else if (!strcmp(vec[0], "off"))
+		tracesyslog = false;
+	else
+		return EINVAL;
+
+	send_ack(conn, XS_CONTROL);
+	return 0;
+}
+
 static int do_control_memreport(void *ctx, struct connection *conn,
 				char **vec, int num)
 {
@@ -133,6 +150,7 @@  static struct cmd_s cmds[] = {
 	{ "check", do_control_check, "" },
 	{ "log", do_control_log, "on|off" },
 	{ "logfile", do_control_logfile, "<file>" },
+	{ "syslog", do_control_logsyslog, "on|off" },
 	{ "memreport", do_control_memreport, "[<file>]" },
 	{ "print", do_control_print, "<string>" },
 	{ "help", do_control_help, "" },