From nobody Mon May 6 07:56:48 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1575451694; cv=none; d=zohomail.com; s=zohoarc; b=bgLq4KNlyq3YtLlI3+kTl5dSaHBOy2u7Pe+jV5abshpnRTbYa0SLiSrH7UsA2s82UqkbbEH1nwwExriMdoIGqe1SPclrY6rIPJjtT2qRAUQdXqkQ+65FxJPYP9d8z+SYavkFxsBvKyxlkWRByd8njvulFu6ZeTNHeD3IGSJ2E8w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575451694; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=m5lDZzmDJ0fFRvnJg/FjZIOkMQSuONMZK7tZ10ebtfY=; b=ihQY/h7dgVyvqplAzEsM8C/9pFvaF3G5X5j0C7qXXKsB5Vd02u8tWzW8MBjuyUdLLO/wVYq2MRjCqYZ3zuDE6Rbqv+JmM+bX50ZRUipaIlfgCIcwKlm3RIKUV1NDzmuRKCOY9d+mEXVs00S71mHOz8kUlMR01zeszEBAlCWK5jA= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1575451694830501.7462530806339; Wed, 4 Dec 2019 01:28:14 -0800 (PST) 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 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 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) 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) X-Inumbo-ID: 47705d2a-1678-11ea-81fe-12813bfff9fa 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 X-Virus-Scanned: Debian amavisd-new at dingwall.me.uk 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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_cor= e.c index c8e423700d..d0b383becc 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -79,6 +79,7 @@ static bool recovery =3D true; static int reopen_log_pipe[2]; static int reopen_log_pipe0_pollfd_idx =3D -1; char *tracefile =3D NULL; +bool tracesyslog =3D false; TDB_CONTEXT *tdb_ctx =3D NULL; =20 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[] =3D { { "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; =20 =20 - while ((opt =3D getopt_long(argc, argv, "DE:F:HNPS:t:T:RVW:", options, + while ((opt =3D getopt_long(argc, argv, "DE:F:HNPS:t:T:RVW:Y", options, NULL)) !=3D -1) { switch (opt) { case 'D': @@ -1960,6 +1963,9 @@ int main(int argc, char *argv[]) case 'W': quota_nb_watch_per_domain =3D strtol(optarg, NULL, 10); break; + case 'Y': + tracesyslog =3D true; + break; case 'e': dom0_event =3D strtol(optarg, NULL, 10); break; diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_cor= e.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 str= uct buffered_data *data, void reopen_log(void); void close_log(void); =20 +extern bool tracesyslog; extern char *tracefile; extern int tracefd; =20 --=20 2.24.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Mon May 6 07:56:48 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1575451694; cv=none; d=zohomail.com; s=zohoarc; b=JbI9AobX2fw0q6ztAw/u1mTeOx+6bOXdcwD7p5CedMITaCGrdw97uHYb07r9rehGdm8JKVpqRZnU9oIycqYLur/oIx5y4nsc0lAiDqTiGPAEdPJNv4YQZB+HUwd9IL8CkxqeI39RS/vhBL8Fz8fmw/TH4qYGC+PAukyjvvh9Ld0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575451694; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GUWNpQpkIp7XrA5PEaiWlvQwIFcPfYttvVdDbLNKBH0=; b=HA1nc3x3Al6ZoHPFmxxfY3bMEsbHTTdN9EPfc3krfM38K3fU4okqHLfswN+Ucilf2FRAB1rIkwV2Z4bsBb34pcyLzUf8FJxqOQ9EHuYVd7O1lxArzY2GxIGFJHXLnVtSysecp1XTBGjMkLHdu+c/1Ka8eqmA85rHZosn4smEhCo= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1575451694742933.4262496167199; Wed, 4 Dec 2019 01:28:14 -0800 (PST) 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 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 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) 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) X-Inumbo-ID: 47705d2b-1678-11ea-81fe-12813bfff9fa 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 X-Virus-Scanned: Debian amavisd-new at dingwall.me.uk 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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 connecti= on *conn, return 0; } =20 +static int do_control_logsyslog(void *ctx, struct connection *conn, + char **vec, int num) +{ + if (num !=3D 1) + return EINVAL; + + if (!strcmp(vec[0], "on")) + tracesyslog =3D true; + else if (!strcmp(vec[0], "off")) + tracesyslog =3D 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[] =3D { { "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, "" }, --=20 2.24.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Mon May 6 07:56:48 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1575452195; cv=none; d=zohomail.com; s=zohoarc; b=EMzgBHl4HOlT7rKqJpib6FNqToMtq/AzeobppMNOBNhak2/x6F2V73DtYeObS/8HVULSNtXeQ1W5lDtwjJXFGW+drxg/tehyAs6c00iiRURCb+iMt5rBEZPpJrGHwxAfL8124AqrBfNXCIatqxKxKVFTIber+VcsL5aZycrsqzs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575452195; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RMpPor+n+UTU3RKpACdARlwFzXjI0bRp4AW66VPdAY8=; b=m8Xw5pVRQqTsmIt/tUOuarOg19l19zxG/2WFbgixQz08hq8n4+LnkiIUs0ezd1IZ/foBQZfXdfI3w8lpP9GvcyvMt5rKil2Z+VzqNe1MC4a2qkcPTnesIoTi7bO0UtIgWml8K1AjlHGsf2GAB/yQuUN4alBWVNcu3VQFg7H3Ezo= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1575452195692964.7142402764497; Wed, 4 Dec 2019 01:36:35 -0800 (PST) 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 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 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) 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) X-Inumbo-ID: 78d03f74-1679-11ea-9c09-bc764e2007e4 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 X-Virus-Scanned: Debian amavisd-new at dingwall.me.uk 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: James Dingwall Unconditionally openlog() since we allow tracesyslog to be changed at runti= me. 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 wor= ks well when the output is a file stream but may not suit vsyslog() quite as w= ell. 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_cor= e.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 t= ype); char *s =3D 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; =20 + if (tracesyslog) { + va_start(arglist, fmt); + vsyslog(LOG_DEBUG, fmt, arglist); + va_end(arglist); + } + if (tracefd < 0) return; =20 @@ -1987,10 +1993,9 @@ int main(int argc, char *argv[]) mkdir(xs_daemon_rundir(), 0755); mkdir(xs_daemon_rootdir(), 0755); =20 - if (dofork) { - openlog("xenstored", 0, LOG_DAEMON); + openlog("xenstored", 0, LOG_DAEMON); + if (dofork) daemonize(); - } if (pidfile) write_pidfile(pidfile); =20 --=20 2.24.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Mon May 6 07:56:48 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1575451694; cv=none; d=zohomail.com; s=zohoarc; b=nLWXKe6PhlQ0o4/1JsgrqbuqFL9ttM8snBnI5UpqMFz3AS/l/tDmj9qsrXHeRS9XnN+yZgT8vrxwez20IeP3gOd3BVH7TkodchaFAV/c4k//Qh42SxMfg/Fk2Eql48AE2Adn5Qm07IbtyPm73226VabjNWDYKQVwnxa0WeTpyto= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575451694; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bWra2cfAqwiHmZHMOihXmVZ4m+DdF7Az4tm0418b8dA=; b=i4uFboDaBosgvKA00U1HHrRRM+pu4Ycm9+itiD7bwYjSoDaAiMRaLTnAQb5PHJv6yDH3atHVF3s8w8VB6mnyp7/MWi2XW+WmeWmqLgn0j3Ae/X2UstlnIlBVPNcKv34fvBJA4Yr/RWBzaNf+Y6GPXLTVh9O3jbSje5Z/+O/hTLQ= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1575451694855200.7769164115756; Wed, 4 Dec 2019 01:28:14 -0800 (PST) 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 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 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) 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) X-Inumbo-ID: 47955602-1678-11ea-aea8-bc764e2007e4 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 X-Virus-Scanned: Debian amavisd-new at dingwall.me.uk 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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" =20 +#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 =20 void (*xprintf)(const char *fmt, ...) =3D default_xprintf; =20 --=20 2.24.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel