From patchwork Wed Dec 4 09:27:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Dingwall X-Patchwork-Id: 11272543 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4FE86138C for ; Wed, 4 Dec 2019 09:28:38 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3419320675 for ; Wed, 4 Dec 2019 09:28:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3419320675 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=dingwall.me.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1icQwW-0001rf-F1; Wed, 04 Dec 2019 09:27:32 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1icQwV-0001r5-5P for xen-devel@lists.xenproject.org; Wed, 04 Dec 2019 09:27:31 +0000 X-Inumbo-ID: 47705d2a-1678-11ea-81fe-12813bfff9fa Received: from know-smtprelay-omc-3.server.virginmedia.net (unknown [80.0.253.67]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 47705d2a-1678-11ea-81fe-12813bfff9fa; Wed, 04 Dec 2019 09:27:24 +0000 (UTC) Received: from mail0.xen.dingwall.me.uk ([82.47.84.47]) by cmsmtp with ESMTPA id cQwNilTneMk4gcQwNiUugr; Wed, 04 Dec 2019 09:27:23 +0000 X-Originating-IP: [82.47.84.47] X-Authenticated-User: james.dingwall@blueyonder.co.uk X-Spam: 0 X-Authority: v=2.3 cv=Rfa+9Wlv c=1 sm=1 tr=0 a=0bfgdX8EJi0Cr9X0x0jFDA==:117 a=0bfgdX8EJi0Cr9X0x0jFDA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=xqWC_Br6kY4A:10 a=pxVhFHJ0LMsA:10 a=5IRWAbXhAAAA:8 a=VF6w29W6N5P4AWm6VDUA:9 a=AJ2fcQ_F1HIVBPS0:21 a=KZYNt8ff4v5rtnoV:21 a=xo7gz2vLY8DhO4BdlxfM:22 Received: from localhost (localhost [IPv6:::1]) by mail0.xen.dingwall.me.uk (Postfix) with ESMTP id C373315941D; Wed, 4 Dec 2019 09:27:41 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at dingwall.me.uk Received: from mail0.xen.dingwall.me.uk ([IPv6:::1]) by localhost (mail0.xen.dingwall.me.uk [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 4vHU23Vkuy3M; Wed, 4 Dec 2019 09:27:41 +0000 (UTC) Received: from behemoth.dingwall.me.uk (behemoth.dingwall.me.uk [192.168.1.5]) by dingwall.me.uk (Postfix) with ESMTP id 8AD7C159414; Wed, 4 Dec 2019 09:27:41 +0000 (UTC) Received: by behemoth.dingwall.me.uk (Postfix, from userid 1000) id 862E5140E17; Wed, 4 Dec 2019 09:27:41 +0000 (UTC) From: james-xen@dingwall.me.uk To: xen-devel@lists.xenproject.org Date: Wed, 4 Dec 2019 09:27:36 +0000 Message-Id: <20191204092739.18177-2-james-xen@dingwall.me.uk> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204092739.18177-1-james-xen@dingwall.me.uk> References: <20191204092739.18177-1-james-xen@dingwall.me.uk> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfMwp32QxQOJTLzY+MwLbkx+8ze7848ZeIpY21eg5iEbuT67dRWEDzBIZz+j+umI7w76y5rxBfu856CrHgxa/YOXRtUSORrITzE+v19eq5q76WJKpaTjQ /Pgitv451uww3oLLDbyDux7EtEXLFuyAuTfMdUyvcFYX3wXP/A6B+BWqqvQWxWnL2mo1qNVEPEoe2F8xZOStrT5vwPvGiyidTC1kPgtVHfQGxKC9V4F2jW/Z dVDu2Hl5Z/wcpKyVSwziTxnfUeiMinxW83EYh/C2+40= Subject: [Xen-devel] [PATCH 1/4] xenstored logging: introduce -Y / --trace-syslog option X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: wei.liu2@citrix.com, ian.jackson@eu.citrix.com, James Dingwall Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: James Dingwall Add a new command line argument -Y / --trace-syslog which toggles the boolean tracesyslog variable. --- tools/xenstore/xenstored_core.c | 10 ++++++++-- tools/xenstore/xenstored_core.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c index c8e423700d..d0b383becc 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -79,6 +79,7 @@ static bool recovery = true; static int reopen_log_pipe[2]; static int reopen_log_pipe0_pollfd_idx = -1; char *tracefile = NULL; +bool tracesyslog = false; TDB_CONTEXT *tdb_ctx = NULL; static const char *sockmsg_string(enum xsd_sockmsg_type type); @@ -1871,7 +1872,8 @@ static void usage(void) " -H, --help to output this message,\n" " -N, --no-fork to request that the daemon does not fork,\n" " -P, --output-pid to request that the pid of the daemon is output,\n" -" -T, --trace-file giving the file for logging, and\n" +" -T, --trace-file giving the file for logging, and/or\n" +" -Y, --trace-syslog writing trace message to syslog,\n" " -E, --entry-nb limit the number of entries per domain,\n" " -S, --entry-size limit the size of entry per domain, and\n" " -W, --watch-nb limit the number of watches per domain,\n" @@ -1895,6 +1897,7 @@ static struct option options[] = { { "output-pid", 0, NULL, 'P' }, { "entry-size", 1, NULL, 'S' }, { "trace-file", 1, NULL, 'T' }, + { "trace-syslog", 0, NULL, 'Y' }, { "transaction", 1, NULL, 't' }, { "no-recovery", 0, NULL, 'R' }, { "internal-db", 0, NULL, 'I' }, @@ -1918,7 +1921,7 @@ int main(int argc, char *argv[]) int timeout; - while ((opt = getopt_long(argc, argv, "DE:F:HNPS:t:T:RVW:", options, + while ((opt = getopt_long(argc, argv, "DE:F:HNPS:t:T:RVW:Y", options, NULL)) != -1) { switch (opt) { case 'D': @@ -1960,6 +1963,9 @@ int main(int argc, char *argv[]) case 'W': quota_nb_watch_per_domain = strtol(optarg, NULL, 10); break; + case 'Y': + tracesyslog = true; + break; case 'e': dom0_event = strtol(optarg, NULL, 10); break; diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_core.h index 3d7eb91254..f5b0d70da4 100644 --- a/tools/xenstore/xenstored_core.h +++ b/tools/xenstore/xenstored_core.h @@ -174,6 +174,7 @@ void dtrace_io(const struct connection *conn, const struct buffered_data *data, void reopen_log(void); void close_log(void); +extern bool tracesyslog; extern char *tracefile; extern int tracefd; From patchwork Wed Dec 4 09:27:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Dingwall X-Patchwork-Id: 11272547 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D097114B7 for ; Wed, 4 Dec 2019 09:28:43 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B56C120675 for ; Wed, 4 Dec 2019 09:28:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B56C120675 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=dingwall.me.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1icQwQ-0001qn-VA; Wed, 04 Dec 2019 09:27:26 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1icQwQ-0001qd-4f for xen-devel@lists.xenproject.org; Wed, 04 Dec 2019 09:27:26 +0000 X-Inumbo-ID: 47705d2b-1678-11ea-81fe-12813bfff9fa Received: from know-smtprelay-omc-1.server.virginmedia.net (unknown [80.0.253.65]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 47705d2b-1678-11ea-81fe-12813bfff9fa; Wed, 04 Dec 2019 09:27:24 +0000 (UTC) Received: from mail0.xen.dingwall.me.uk ([82.47.84.47]) by cmsmtp with ESMTPA id cQwNiY5hqxs8ecQwNioh3X; Wed, 04 Dec 2019 09:27:23 +0000 X-Originating-IP: [82.47.84.47] X-Authenticated-User: james.dingwall@blueyonder.co.uk X-Spam: 0 X-Authority: v=2.3 cv=L98zvdb8 c=1 sm=1 tr=0 a=0bfgdX8EJi0Cr9X0x0jFDA==:117 a=0bfgdX8EJi0Cr9X0x0jFDA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=xqWC_Br6kY4A:10 a=pxVhFHJ0LMsA:10 a=5IRWAbXhAAAA:8 a=Sk5AkFDSzmZvWLMj57EA:9 a=G6QAcT8NE79V4_GB:21 a=pniMzHNUB-FszkVU:21 a=xo7gz2vLY8DhO4BdlxfM:22 Received: from localhost (localhost [IPv6:::1]) by mail0.xen.dingwall.me.uk (Postfix) with ESMTP id E9B07159423; Wed, 4 Dec 2019 09:27:41 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at dingwall.me.uk Received: from mail0.xen.dingwall.me.uk ([IPv6:::1]) by localhost (mail0.xen.dingwall.me.uk [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id K8vWBOZ4fSQp; Wed, 4 Dec 2019 09:27:41 +0000 (UTC) Received: from behemoth.dingwall.me.uk (behemoth.dingwall.me.uk [IPv6:2001:470:695c:302::c0a8:105]) by dingwall.me.uk (Postfix) with ESMTP id 8ADB9159415; Wed, 4 Dec 2019 09:27:41 +0000 (UTC) Received: by behemoth.dingwall.me.uk (Postfix, from userid 1000) id 8EC0B140E19; Wed, 4 Dec 2019 09:27:41 +0000 (UTC) From: james-xen@dingwall.me.uk To: xen-devel@lists.xenproject.org Date: Wed, 4 Dec 2019 09:27:37 +0000 Message-Id: <20191204092739.18177-3-james-xen@dingwall.me.uk> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204092739.18177-1-james-xen@dingwall.me.uk> References: <20191204092739.18177-1-james-xen@dingwall.me.uk> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfKZJoxklV5Q0Crbpl0ZLACJxmaLTqKK6ekPEx8uMnDO5p1kjjD1esGp12wJKNL49IdkWu7Gf7CztIe8p8YMUwMzuIKFOUprkyINvei5hZ1YXg7gtsnRl 5FtC7oEvAQNu+j0pAzSVopzAkwDJG+E603ho9qrM1KK7A9g13YbqQg1D7xjI5wm2evASO8HKBoYuUgcFh65K0Omec8bRgQzAsYtHn8CwyxL+ByavkDOFYH+c cKHD2q24E0ilvqeb+l33P6e5wJVQ+iaquWicJ7YTp5E= Subject: [Xen-devel] [PATCH 2/4] xenstored logging: add control to dynamically toggle tracesyslog flag X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: wei.liu2@citrix.com, ian.jackson@eu.citrix.com, James Dingwall Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: James Dingwall 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 --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, "" }, + { "syslog", do_control_logsyslog, "on|off" }, { "memreport", do_control_memreport, "[]" }, { "print", do_control_print, "" }, { "help", do_control_help, "" }, From patchwork Wed Dec 4 09:27:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Dingwall X-Patchwork-Id: 11272565 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 205B6109A for ; Wed, 4 Dec 2019 09:37:02 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 057F52053B for ; Wed, 4 Dec 2019 09:37:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 057F52053B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=dingwall.me.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1icR4j-000391-DG; Wed, 04 Dec 2019 09:36:01 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1icR4i-00038v-2v for xen-devel@lists.xenproject.org; Wed, 04 Dec 2019 09:36:00 +0000 X-Inumbo-ID: 78d03f74-1679-11ea-9c09-bc764e2007e4 Received: from know-smtprelay-omc-1.server.virginmedia.net (unknown [80.0.253.65]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 78d03f74-1679-11ea-9c09-bc764e2007e4; Wed, 04 Dec 2019 09:35:56 +0000 (UTC) Received: from mail0.xen.dingwall.me.uk ([82.47.84.47]) by cmsmtp with ESMTPA id cR4diY7jaxs8ecR4eiohNM; Wed, 04 Dec 2019 09:35:56 +0000 X-Originating-IP: [82.47.84.47] X-Authenticated-User: james.dingwall@blueyonder.co.uk X-Spam: 0 X-Authority: v=2.3 cv=L98zvdb8 c=1 sm=1 tr=0 a=0bfgdX8EJi0Cr9X0x0jFDA==:117 a=0bfgdX8EJi0Cr9X0x0jFDA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=xqWC_Br6kY4A:10 a=pxVhFHJ0LMsA:10 a=5IRWAbXhAAAA:8 a=mRPDriDQJ0hduQnMumMA:9 a=xo7gz2vLY8DhO4BdlxfM:22 Received: from localhost (localhost [IPv6:::1]) by mail0.xen.dingwall.me.uk (Postfix) with ESMTP id E713A159422; Wed, 4 Dec 2019 09:27:41 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at dingwall.me.uk Received: from mail0.xen.dingwall.me.uk ([127.0.0.1]) by localhost (mail0.xen.dingwall.me.uk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DIq7iu0M9xbk; Wed, 4 Dec 2019 09:27:41 +0000 (UTC) Received: from behemoth.dingwall.me.uk (behemoth.dingwall.me.uk [192.168.1.5]) by dingwall.me.uk (Postfix) with ESMTP id 94175159416; Wed, 4 Dec 2019 09:27:41 +0000 (UTC) Received: by behemoth.dingwall.me.uk (Postfix, from userid 1000) id 9A520140E1B; Wed, 4 Dec 2019 09:27:41 +0000 (UTC) From: james-xen@dingwall.me.uk To: xen-devel@lists.xenproject.org Date: Wed, 4 Dec 2019 09:27:38 +0000 Message-Id: <20191204092739.18177-4-james-xen@dingwall.me.uk> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204092739.18177-1-james-xen@dingwall.me.uk> References: <20191204092739.18177-1-james-xen@dingwall.me.uk> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfFbKXe4h9U4sHtQw4v3QuvDrKLs+jDlRDl3PnRwK5sYfjFHy2JmrkLM1TmHYBeDkHyYahSKxz7nSwtkpaxoz10vl6jKpDkI8g7/fSb5sl3ujPm6GaAUo TUdmbkj2H5CP9mAeq3gZCFTiETlOaqNPQKOvJRiq/zSnqLu6Y3aVQlyaEOqC9EqLuyFqE2ODdz24l9ZbyL/f2irqFCsAWf1ZdDskZyLI0b9qAoxPzN9TKrWU moZUZs2DrXEmE0UG0+IfZ3sWOjPdsPf+Yxgmchox4lg= Subject: [Xen-devel] [PATCH 3/4] xenstored logging: send trace messages to syslog X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: wei.liu2@citrix.com, ian.jackson@eu.citrix.com, James Dingwall Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: James Dingwall Unconditionally openlog() since we allow tracesyslog to be changed at runtime. Modify the trace() call to send messages to vsyslog() when tracesyslog is enabled. Note some trace() messages come in several calls before the '\n'. This works well when the output is a file stream but may not suit vsyslog() quite as well. Primarily this feature is for xenstored in a stubdom which doesn't wrap the message until '\n' so no attempt to coalesce trace() calls until '\n' is made. (Could trace() use vfprintf() to write to the log file?) --- tools/xenstore/xenstored_core.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c index d0b383becc..5320db2499 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -89,7 +89,7 @@ static const char *sockmsg_string(enum xsd_sockmsg_type type); char *s = talloc_asprintf(NULL, __VA_ARGS__); \ if (s) { \ trace("%s\n", s); \ - syslog(LOG_ERR, "%s", s); \ + syslog(LOG_ERR, "%s\n", s); \ talloc_free(s); \ } else { \ trace("talloc failure during logging\n"); \ @@ -110,6 +110,12 @@ void trace(const char *fmt, ...) char sbuf[1024]; int ret, dummy; + if (tracesyslog) { + va_start(arglist, fmt); + vsyslog(LOG_DEBUG, fmt, arglist); + va_end(arglist); + } + if (tracefd < 0) return; @@ -1987,10 +1993,9 @@ int main(int argc, char *argv[]) mkdir(xs_daemon_rundir(), 0755); mkdir(xs_daemon_rootdir(), 0755); - if (dofork) { - openlog("xenstored", 0, LOG_DAEMON); + openlog("xenstored", 0, LOG_DAEMON); + if (dofork) daemonize(); - } if (pidfile) write_pidfile(pidfile); From patchwork Wed Dec 4 09:27:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Dingwall X-Patchwork-Id: 11272545 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5D5A3138C for ; Wed, 4 Dec 2019 09:28:42 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 41B3820675 for ; Wed, 4 Dec 2019 09:28:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 41B3820675 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=dingwall.me.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1icQwW-0001rx-Oe; Wed, 04 Dec 2019 09:27:32 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1icQwV-0001rC-DB for xen-devel@lists.xenproject.org; Wed, 04 Dec 2019 09:27:31 +0000 X-Inumbo-ID: 47955602-1678-11ea-aea8-bc764e2007e4 Received: from know-smtprelay-omc-1.server.virginmedia.net (unknown [80.0.253.65]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 47955602-1678-11ea-aea8-bc764e2007e4; Wed, 04 Dec 2019 09:27:24 +0000 (UTC) Received: from mail0.xen.dingwall.me.uk ([82.47.84.47]) by cmsmtp with ESMTPA id cQwNiY5hzxs8ecQwNioh3f; Wed, 04 Dec 2019 09:27:23 +0000 X-Originating-IP: [82.47.84.47] X-Authenticated-User: james.dingwall@blueyonder.co.uk X-Spam: 0 X-Authority: v=2.3 cv=L98zvdb8 c=1 sm=1 tr=0 a=0bfgdX8EJi0Cr9X0x0jFDA==:117 a=0bfgdX8EJi0Cr9X0x0jFDA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=xqWC_Br6kY4A:10 a=pxVhFHJ0LMsA:10 a=5IRWAbXhAAAA:8 a=YFnRBznFj9VQ1rwjkNEA:9 a=xo7gz2vLY8DhO4BdlxfM:22 Received: from localhost (localhost [IPv6:::1]) by mail0.xen.dingwall.me.uk (Postfix) with ESMTP id 249C2159427; Wed, 4 Dec 2019 09:27:42 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at dingwall.me.uk Received: from mail0.xen.dingwall.me.uk ([127.0.0.1]) by localhost (mail0.xen.dingwall.me.uk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uYQc4x1H0yfc; Wed, 4 Dec 2019 09:27:42 +0000 (UTC) Received: from behemoth.dingwall.me.uk (behemoth.dingwall.me.uk [IPv6:2001:470:695c:302::c0a8:105]) by dingwall.me.uk (Postfix) with ESMTP id 98204159417; Wed, 4 Dec 2019 09:27:41 +0000 (UTC) Received: by behemoth.dingwall.me.uk (Postfix, from userid 1000) id A66E6140E1D; Wed, 4 Dec 2019 09:27:41 +0000 (UTC) From: james-xen@dingwall.me.uk To: xen-devel@lists.xenproject.org Date: Wed, 4 Dec 2019 09:27:39 +0000 Message-Id: <20191204092739.18177-5-james-xen@dingwall.me.uk> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204092739.18177-1-james-xen@dingwall.me.uk> References: <20191204092739.18177-1-james-xen@dingwall.me.uk> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfKZJoxklV5Q0Crbpl0ZLACJxmaLTqKK6ekPEx8uMnDO5p1kjjD1esGp12wJKNL49IdkWu7Gf7CztIe8p8YMUwMzuIKFOUprkyINvei5hZ1YXg7gtsnRl 5FtC7oEvAQNu+j0pAzSVopzAkwDJG+E603ho9qrM1KK7A9g13YbqQg1D7xjI5wm2evASO8HKBoYuUgcFh65K0Omec8bRgQzAsYtHn8CwyxL+ByavkDOFYH+c cKHD2q24E0ilvqeb+l33P6e5wJVQ+iaquWicJ7YTp5E= Subject: [Xen-devel] [PATCH 4/4] xenstored logging: add minios variant of default_xprintf() X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: wei.liu2@citrix.com, ian.jackson@eu.citrix.com, James Dingwall Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: James Dingwall 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(+) 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 #include #include +#ifdef __MINIOS__ +#include +#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;