From nobody Tue May 7 20:45:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1538033925004938.6840858918796; Thu, 27 Sep 2018 00:38:45 -0700 (PDT) Received: from localhost ([::1]:34172 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5Qsd-0007nA-2b for importer@patchew.org; Thu, 27 Sep 2018 03:38:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5Qqe-00066M-U0 for qemu-devel@nongnu.org; Thu, 27 Sep 2018 03:36:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g5Qqc-0003e7-3m for qemu-devel@nongnu.org; Thu, 27 Sep 2018 03:36:32 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:50231) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g5Qqb-0003dc-Ro for qemu-devel@nongnu.org; Thu, 27 Sep 2018 03:36:30 -0400 Received: by mail-wm1-x32a.google.com with SMTP id s12-v6so4786542wmc.0 for ; Thu, 27 Sep 2018 00:36:29 -0700 (PDT) Received: from bark.daynix ([141.226.163.173]) by smtp.gmail.com with ESMTPSA id y206-v6sm1708129wmg.14.2018.09.27.00.36.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Sep 2018 00:36:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RoXOieiwGLa29yBUbHNmTBhheE+ZLb9eAHolXD0J7Vo=; b=e6f+xF+xnOeKY0mj5aVqHybh0UiDKjBmSZ2cP+KYMrGMiwD4ZphD/0SgKg0bfJdiR/ gzvghv5Opw4e/ivIHq1VD9sxXQ+c9/4zLfrg/eB66/kDuFADkI1jT2em7OB9UDZNTpjb mw7li492P+XRJ1l++z30SNy9bpFVmWaKtsSwe26IM/Jw6/RWcExphNNRphtIdw5bnuY3 mp5SBNvo6APVtlAtVF9+FDO/PRnut1iOB+jAleXK85EuXWPhwymArLOweIB1R96UMWuB Y/gJqiX9E5U655OIiQDuD1cRzSR9Yq+4KlcFvuCtMZd0Bz9P1QbQzGIFQPd+RbQTEJ2z KifQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RoXOieiwGLa29yBUbHNmTBhheE+ZLb9eAHolXD0J7Vo=; b=VzYswiRRxncYT7q3jvFlkfTqn0MpGrp07gBDHKgovR1sC0xL3LWHCQb93IOy/E6LcA lb1yGUkEQ8Le157C5FUhl7tATHBlh8gQiPjotuKcUQ/DylU6j9wp3te3I7ZFQa774g+M 5ksfFveewPH+ePrwWQuo9ACuiNt1V4xz60KCZ9d7y/bu7iwIkftpKc9QL/BBo93IZtRM i8ifEL49a5UvibsWwjbV0CrCKgVnd2SYjQFIbhbP2a1RxKU1rWPsbdkJwAvhjkkKb89h Fo0d//yCERPc24twjMrzU3U2a6FR3p3nP/oFNaeELd1zYK4t3UZWvcOYwR5YnuFqlXgD 9xOA== X-Gm-Message-State: ABuFfojstln83EtOoHhVFszONbjsisVNjlXk+7IJjBDpGj0aj5o8qTrK B74rcJAkoemK/IMMGcT8gj+5KGsL6ek= X-Google-Smtp-Source: ACcGV62vRqscH1eaFl97+GPSuj3uCVn2tAyk4z7VDmiSd//fipDS3K9b0MRdigIu0pAyMnsKS++dQQ== X-Received: by 2002:a1c:9355:: with SMTP id v82-v6mr6828861wmd.128.1538033788554; Thu, 27 Sep 2018 00:36:28 -0700 (PDT) From: Bishara AbuHattoum To: qemu-devel@nongnu.org, Michael Roth Date: Thu, 27 Sep 2018 10:36:18 +0300 Message-Id: <20180927073624.17163-2-bishara@daynix.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180927073624.17163-1-bishara@daynix.com> References: <20180927073624.17163-1-bishara@daynix.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32a Subject: [Qemu-devel] [PATCH 1/7] qga: group agent init/cleanup init separate routines X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yan Vugenfirer Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Michael Roth This patch better separates the init/cleanup routines out into separate functions to make make the start-up procedure a bit easier to follow. This will be useful when we eventually break out the actual start/stop of the agent's main loop into separates routines that can be called multiple times after the init phase. Signed-off-by: Michael Roth Message-Id: <20171026233054.21133-2-mdroth@linux.vnet.ibm.com> Reviewed-by: Marc-Andr=C3=A9 Lureau --- qga/main.c | 82 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 50 insertions(+), 32 deletions(-) diff --git a/qga/main.c b/qga/main.c index 6d70242d05..7b7b837a14 100644 --- a/qga/main.c +++ b/qga/main.c @@ -1245,9 +1245,21 @@ static bool check_is_frozen(GAState *s) return false; } =20 -static int run_agent(GAState *s, GAConfig *config, int socket_activation) +static GAState *initialize_agent(GAConfig *config) { - ga_state =3D s; + GAState *s =3D g_new0(GAState, 1); + + g_assert(ga_state =3D=3D NULL); + + s->log_level =3D config->log_level; + s->log_file =3D stderr; +#ifdef CONFIG_FSFREEZE + s->fsfreeze_hook =3D config->fsfreeze_hook; +#endif + s->pstate_filepath =3D g_strdup_printf("%s/qga.state", config->state_d= ir); + s->state_filepath_isfrozen =3D g_strdup_printf("%s/qga.state.isfrozen", + config->state_dir); + s->frozen =3D check_is_frozen(s); =20 g_log_set_default_handler(ga_log, s); g_log_set_fatal_mask(NULL, G_LOG_LEVEL_ERROR); @@ -1263,7 +1275,7 @@ static int run_agent(GAState *s, GAConfig *config, in= t socket_activation) if (g_mkdir_with_parents(config->state_dir, S_IRWXU) =3D=3D -1) { g_critical("unable to create (an ancestor of) the state directory" " '%s': %s", config->state_dir, strerror(errno)); - return EXIT_FAILURE; + return NULL; } #endif =20 @@ -1288,7 +1300,7 @@ static int run_agent(GAState *s, GAConfig *config, in= t socket_activation) if (!log_file) { g_critical("unable to open specified log file: %s", strerror(errno)); - return EXIT_FAILURE; + return NULL; } s->log_file =3D log_file; } @@ -1299,7 +1311,7 @@ static int run_agent(GAState *s, GAConfig *config, in= t socket_activation) s->pstate_filepath, ga_is_frozen(s))) { g_critical("failed to load persistent state"); - return EXIT_FAILURE; + return NULL; } =20 config->blacklist =3D ga_command_blacklist_init(config->blacklist); @@ -1320,12 +1332,37 @@ static int run_agent(GAState *s, GAConfig *config, = int socket_activation) #ifndef _WIN32 if (!register_signal_handlers()) { g_critical("failed to register signal handlers"); - return EXIT_FAILURE; + return NULL; } #endif =20 s->main_loop =3D g_main_loop_new(NULL, false); =20 + ga_state =3D s; + return s; +} + +static void cleanup_agent(GAState *s) +{ + if (s->command_state) { + ga_command_state_cleanup_all(s->command_state); + ga_command_state_free(s->command_state); + json_message_parser_destroy(&s->parser); + } + if (s->channel) { + ga_channel_free(s->channel); + } + g_free(s->pstate_filepath); + g_free(s->state_filepath_isfrozen); + if (s->main_loop) { + g_main_loop_unref(s->main_loop); + } + g_free(s); + ga_state =3D NULL; +} + +static int run_agent(GAState *s, GAConfig *config, int socket_activation) +{ if (!channel_init(ga_state, config->method, config->channel_path, socket_activation ? FIRST_SOCKET_ACTIVATION_FD : -1)= ) { g_critical("failed to initialize guest agent channel"); @@ -1349,7 +1386,7 @@ static int run_agent(GAState *s, GAConfig *config, in= t socket_activation) int main(int argc, char **argv) { int ret =3D EXIT_SUCCESS; - GAState *s =3D g_new0(GAState, 1); + GAState *s; GAConfig *config =3D g_new0(GAConfig, 1); int socket_activation; =20 @@ -1417,44 +1454,25 @@ int main(int argc, char **argv) } } =20 - s->log_level =3D config->log_level; - s->log_file =3D stderr; -#ifdef CONFIG_FSFREEZE - s->fsfreeze_hook =3D config->fsfreeze_hook; -#endif - s->pstate_filepath =3D g_strdup_printf("%s/qga.state", config->state_d= ir); - s->state_filepath_isfrozen =3D g_strdup_printf("%s/qga.state.isfrozen", - config->state_dir); - s->frozen =3D check_is_frozen(s); - if (config->dumpconf) { config_dump(config); goto end; } =20 + s =3D initialize_agent(config); + if (!s) { + g_critical("error initializing guest agent"); + goto end; + } ret =3D run_agent(s, config, socket_activation); + cleanup_agent(s); =20 end: - if (s->command_state) { - ga_command_state_cleanup_all(s->command_state); - ga_command_state_free(s->command_state); - json_message_parser_destroy(&s->parser); - } - if (s->channel) { - ga_channel_free(s->channel); - } - g_free(s->pstate_filepath); - g_free(s->state_filepath_isfrozen); - if (config->daemonize) { unlink(config->pid_filepath); } =20 config_free(config); - if (s->main_loop) { - g_main_loop_unref(s->main_loop); - } - g_free(s); =20 return ret; } --=20 2.17.0 From nobody Tue May 7 20:45:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1538034143370970.2809759689009; Thu, 27 Sep 2018 00:42:23 -0700 (PDT) Received: from localhost ([::1]:34193 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5QwF-0002Va-WC for importer@patchew.org; Thu, 27 Sep 2018 03:42:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59262) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5Qqe-00066K-T8 for qemu-devel@nongnu.org; Thu, 27 Sep 2018 03:36:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g5Qqd-0003fC-Hs for qemu-devel@nongnu.org; Thu, 27 Sep 2018 03:36:32 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:39195) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g5Qqd-0003eh-AK for qemu-devel@nongnu.org; Thu, 27 Sep 2018 03:36:31 -0400 Received: by mail-wr1-x42e.google.com with SMTP id s14-v6so1416452wrw.6 for ; Thu, 27 Sep 2018 00:36:31 -0700 (PDT) Received: from bark.daynix ([141.226.163.173]) by smtp.gmail.com with ESMTPSA id y206-v6sm1708129wmg.14.2018.09.27.00.36.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Sep 2018 00:36:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pLbvuiTOHY3b1SCuXYwS6lnZkP9+UJfVAP+5Zvqc9WE=; b=tyQMGMx7Zy1izsMnya7JLVn6yK4M6Sl6yTDB/ndxFBdKTfcweLt5dfOBPuGeNvYA34 NoOar3mS54ntSCvU5Nj0aKtcOesErwxWSSLvgaZr8xRjPGXhr2xbF2AHCYtIcZTyBAJJ 9YKX8j7VNJZ2FXNqYKvbekkGKuCDSUWNkwt4ip4ivQ50pO9pwr3fE8zHwmS6kE3zQ7SD Li+VeVFoShL/H3TdC10EPKrsXo8Z+unPtLU05Pp9Na7M1J3Zq6kPrF0Jtz7vHZBJnt34 rYlGoUOcJsSzYwem81aLrjlnZzQvH/s6/vxTrzq9K3OffbCNRTd1lgM9fH6UBscS9vQe mlJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pLbvuiTOHY3b1SCuXYwS6lnZkP9+UJfVAP+5Zvqc9WE=; b=Dff3Kb/qSLXOxmujtmq4dAuJgvFzj0KNU9WzBKlVR6qNwGdYkgST7NWBTnCZeBfCcb ix6RQznVirH1WCBGiStgAlVllWBbH/5+7eXAYFeI6ccPuvAXPqaGe+nsn5WTPLYC3aGd JCHO7eLuqiFJ+iYwhnRGlmxgEcqU6Z1o2yPxbusIP9xgVBCfz6EydhjgLeweIl5wZ2bD v4KuUzUL7HjHKjnndzNFZ8ZPzDBto2QKrqvGexA5qm3qAdgj68wKIijLTMVHPp72DLmE DPxshmdl6BjFmQro7ED5GX1D2cKjykDs2YxP838vDLowl1pd2kaCFvdxKQE36/ArutIJ AJlw== X-Gm-Message-State: ABuFfoi898OJObiSSK6wG8rbIbZ+yf+xz7MczUPcLtLacXyHKsbwkwF2 naOel65XvJZl9M+00r2+bagMeFg7hos= X-Google-Smtp-Source: ACcGV60QZ+FR64s+R6nRBpq6xdQnhBe2rJGgLym/8cpQ300+zZGHx/d97r6O5JWx2URAoyAPo8Ziyg== X-Received: by 2002:adf:8483:: with SMTP id 3-v6mr7777181wrg.34.1538033789979; Thu, 27 Sep 2018 00:36:29 -0700 (PDT) From: Bishara AbuHattoum To: qemu-devel@nongnu.org, Michael Roth Date: Thu, 27 Sep 2018 10:36:19 +0300 Message-Id: <20180927073624.17163-3-bishara@daynix.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180927073624.17163-1-bishara@daynix.com> References: <20180927073624.17163-1-bishara@daynix.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42e Subject: [Qemu-devel] [PATCH 2/7] qga: hang GAConfig/socket_activation off of GAState global X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yan Vugenfirer Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Michael Roth For w32 services we rely on the global GAState to access resources associated with the agent within service_main(). Currently this is sufficient for starting the agent since we open the channel once prior to calling service_main(), and simply start the GMainLoop to start the agent from within service_main(). Eventually we want to be able to also [re-]open the communication channel from within service_main(), which requires access to config/socket_activation variables, so we hang them off GAState in preparation for that. Signed-off-by: Michael Roth Message-Id: <20171026233054.21133-3-mdroth@linux.vnet.ibm.com> Signed-off-by: Sameeh Jubran --- qga/main.c | 54 +++++++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/qga/main.c b/qga/main.c index 7b7b837a14..7381053a0f 100644 --- a/qga/main.c +++ b/qga/main.c @@ -69,6 +69,25 @@ typedef struct GAPersistentState { int64_t fd_counter; } GAPersistentState; =20 +typedef struct GAConfig { + char *channel_path; + char *method; + char *log_filepath; + char *pid_filepath; +#ifdef CONFIG_FSFREEZE + char *fsfreeze_hook; +#endif + char *state_dir; +#ifdef _WIN32 + const char *service; +#endif + gchar *bliststr; /* blacklist may point to this string */ + GList *blacklist; + int daemonize; + GLogLevelFlags log_level; + int dumpconf; +} GAConfig; + struct GAState { JSONMessageParser parser; GMainLoop *main_loop; @@ -94,6 +113,8 @@ struct GAState { #endif gchar *pstate_filepath; GAPersistentState pstate; + GAConfig *config; + int socket_activation; }; =20 struct GAState *ga_state; @@ -939,25 +960,6 @@ static GList *split_list(const gchar *str, const gchar= *delim) return list; } =20 -typedef struct GAConfig { - char *channel_path; - char *method; - char *log_filepath; - char *pid_filepath; -#ifdef CONFIG_FSFREEZE - char *fsfreeze_hook; -#endif - char *state_dir; -#ifdef _WIN32 - const char *service; -#endif - gchar *bliststr; /* blacklist may point to this string */ - GList *blacklist; - int daemonize; - GLogLevelFlags log_level; - int dumpconf; -} GAConfig; - static void config_load(GAConfig *config) { GError *gerr =3D NULL; @@ -1245,7 +1247,7 @@ static bool check_is_frozen(GAState *s) return false; } =20 -static GAState *initialize_agent(GAConfig *config) +static GAState *initialize_agent(GAConfig *config, int socket_activation) { GAState *s =3D g_new0(GAState, 1); =20 @@ -1338,6 +1340,8 @@ static GAState *initialize_agent(GAConfig *config) =20 s->main_loop =3D g_main_loop_new(NULL, false); =20 + s->config =3D config; + s->socket_activation =3D socket_activation; ga_state =3D s; return s; } @@ -1361,10 +1365,10 @@ static void cleanup_agent(GAState *s) ga_state =3D NULL; } =20 -static int run_agent(GAState *s, GAConfig *config, int socket_activation) +static int run_agent(GAState *s) { - if (!channel_init(ga_state, config->method, config->channel_path, - socket_activation ? FIRST_SOCKET_ACTIVATION_FD : -1)= ) { + if (!channel_init(s, s->config->method, s->config->channel_path, + s->socket_activation ? FIRST_SOCKET_ACTIVATION_FD : = -1)) { g_critical("failed to initialize guest agent channel"); return EXIT_FAILURE; } @@ -1459,12 +1463,12 @@ int main(int argc, char **argv) goto end; } =20 - s =3D initialize_agent(config); + s =3D initialize_agent(config, socket_activation); if (!s) { g_critical("error initializing guest agent"); goto end; } - ret =3D run_agent(s, config, socket_activation); + ret =3D run_agent(s); cleanup_agent(s); =20 end: --=20 2.17.0 From nobody Tue May 7 20:45:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15380339832291005.5928076751566; Thu, 27 Sep 2018 00:39:43 -0700 (PDT) Received: from localhost ([::1]:34174 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5Qti-0000Gn-3V for importer@patchew.org; Thu, 27 Sep 2018 03:39:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5Qqg-00067V-4e for qemu-devel@nongnu.org; Thu, 27 Sep 2018 03:36:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g5Qqe-0003oI-US for qemu-devel@nongnu.org; Thu, 27 Sep 2018 03:36:33 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:40663) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g5Qqe-0003gj-IN for qemu-devel@nongnu.org; Thu, 27 Sep 2018 03:36:32 -0400 Received: by mail-wr1-x42a.google.com with SMTP id y8-v6so1415052wrh.7 for ; Thu, 27 Sep 2018 00:36:32 -0700 (PDT) Received: from bark.daynix ([141.226.163.173]) by smtp.gmail.com with ESMTPSA id y206-v6sm1708129wmg.14.2018.09.27.00.36.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Sep 2018 00:36:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cMki+yWgqGNj6df9psObSnQQdBlE588Lc4TNkfrn9h8=; b=uuH4tJFtYHjDt3TdeHrFUAOcV/dUrAuqvFUHMZHjElFZvv8jKtF3nW9FXO+VWj2F+j rOBKmHZNqVY92sa1w3e3WkvC134N0lF7DB3jNHVe6IvBFBUFLaBACxFo/QwqyKg+fZ2T Ci6t16F+hrZIMJ5f3B5YKXjz5oWlbu4UwSwuZNhzAuQo7Ijte3+BLadfC2F5L9+FXiOz cX6VParPXosCtF5iA+aseQiURwAHCLpYxp72hcqTr+2R+/SH+3pVFeT/YY80TwiFBPN1 nBpyuA0tcaKKnr+gtSfYTLgZxuYnwtckGPcyzb20KwKXKx555E8EsFnPab+sdF4SODXq Rsew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cMki+yWgqGNj6df9psObSnQQdBlE588Lc4TNkfrn9h8=; b=bQO3edPzx9C1KzzbbwFwlY56DVexIC0tR+vlMsuD3VVbYgkLVNwQd4DqKeDp3SYgv5 C01+IKhNico/7fuS098+NbEcsr+ijSV+n7/TN6EVvD1443+WM8v0aLTa6QV020nhFceH 2lk2wa7HsoeoNudaAMF28/6rANdzuhV2jril51s9+cZG9LYj6U4gaMkjlvZFlH3J0xu5 W+EW3x1G/NPQIqAI8xLQGsB/H0bdrepuc8j+yC6AoSfKq+P3Z8snbyYeC0bB6hmJpgUT bpaHtKF302lNqN/3we59JOYJRn9fjmvZrB5ueSFEN9lbTdpl2qM+WRVvITRH11d9fEuK lMpw== X-Gm-Message-State: ABuFfog8iHKmOTDTwSqqCZ7ezXZjXFVVn18nnmrFz2vTheGs3TT5W0WQ 3ZYVmCX0yHzEeQ/95ajT8vDqrJ20QV8= X-Google-Smtp-Source: ACcGV61LTRnpGHHUWkPbojvlEzGxTF6QG2TfpjBylal9ZZ5gvsSDDoPL8hBsaUNSbGBMtiycRF1EOA== X-Received: by 2002:adf:a925:: with SMTP id u34-v6mr8205475wrc.175.1538033791237; Thu, 27 Sep 2018 00:36:31 -0700 (PDT) From: Bishara AbuHattoum To: qemu-devel@nongnu.org, Michael Roth Date: Thu, 27 Sep 2018 10:36:20 +0300 Message-Id: <20180927073624.17163-4-bishara@daynix.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180927073624.17163-1-bishara@daynix.com> References: <20180927073624.17163-1-bishara@daynix.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42a Subject: [Qemu-devel] [PATCH 3/7] qga: move w32 service handling out of run_agent() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yan Vugenfirer Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Michael Roth Eventually we want a w32 service to be able to restart the qga main loop from within service_main(). To allow for this we move service handling out of run_agent() such that service_main() calls run_agent() instead of the reverse. Signed-off-by: Michael Roth Message-Id: <20171026233054.21133-4-mdroth@linux.vnet.ibm.com> --- qga/main.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/qga/main.c b/qga/main.c index 7381053a0f..d9888bff5f 100644 --- a/qga/main.c +++ b/qga/main.c @@ -136,6 +136,7 @@ DWORD WINAPI service_ctrl_handler(DWORD ctrl, DWORD typ= e, LPVOID data, LPVOID ctx); VOID WINAPI service_main(DWORD argc, TCHAR *argv[]); #endif +static int run_agent(GAState *s); =20 static void init_dfl_pathnames(void) @@ -763,7 +764,7 @@ VOID WINAPI service_main(DWORD argc, TCHAR *argv[]) service->status.dwWaitHint =3D 0; SetServiceStatus(service->status_handle, &service->status); =20 - g_main_loop_run(ga_state->main_loop); + run_agent(ga_state); =20 service->status.dwCurrentState =3D SERVICE_STOPPED; SetServiceStatus(service->status_handle, &service->status); @@ -1372,17 +1373,8 @@ static int run_agent(GAState *s) g_critical("failed to initialize guest agent channel"); return EXIT_FAILURE; } -#ifndef _WIN32 + g_main_loop_run(ga_state->main_loop); -#else - if (config->daemonize) { - SERVICE_TABLE_ENTRY service_table[] =3D { - { (char *)QGA_SERVICE_NAME, service_main }, { NULL, NULL } }; - StartServiceCtrlDispatcher(service_table); - } else { - g_main_loop_run(ga_state->main_loop); - } -#endif =20 return EXIT_SUCCESS; } @@ -1468,7 +1460,18 @@ int main(int argc, char **argv) g_critical("error initializing guest agent"); goto end; } + +#ifdef _WIN32 + if (config->daemonize) { + SERVICE_TABLE_ENTRY service_table[] =3D { + { (char *)QGA_SERVICE_NAME, service_main }, { NULL, NULL } }; + StartServiceCtrlDispatcher(service_table); + } else { + ret =3D run_agent(s); + } +#endif ret =3D run_agent(s); + cleanup_agent(s); =20 end: --=20 2.17.0 From nobody Tue May 7 20:45:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1538033924888266.47522484494937; Thu, 27 Sep 2018 00:38:44 -0700 (PDT) Received: from localhost ([::1]:34173 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5Qsi-0007rX-7O for importer@patchew.org; Thu, 27 Sep 2018 03:38:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59312) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5Qqh-00068u-AR for qemu-devel@nongnu.org; Thu, 27 Sep 2018 03:36:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g5Qqg-0003sm-82 for qemu-devel@nongnu.org; Thu, 27 Sep 2018 03:36:35 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:33366) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g5Qqf-0003pM-Of for qemu-devel@nongnu.org; Thu, 27 Sep 2018 03:36:34 -0400 Received: by mail-wm1-x333.google.com with SMTP id r1-v6so16808920wmh.0 for ; Thu, 27 Sep 2018 00:36:33 -0700 (PDT) Received: from bark.daynix ([141.226.163.173]) by smtp.gmail.com with ESMTPSA id y206-v6sm1708129wmg.14.2018.09.27.00.36.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Sep 2018 00:36:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JT/l1v+hTANO941RcdPrrNcCCSNAMYx1qZp+59xzz/M=; b=0+7ColpJMtyGSa9e7OHGvQYk8QCuFGUBYzC7ldOTfm2PDoh1HfGoJ4vUmxrcoIRRqE VwoVc/QGBxZ3O5DsqsdvGhCu7XgwVTtWeOvDBAAu1AMBMzWXRgXUGm1i5Bptz5lsX5OP ifUvhIQFJC4F35Gnj1C2THB5iOHo88nyI7nm3og1ofngDMgw0TIdXb6y9JGvM/mRBd0g hI6qWOFNUiuOacWK36j8qSUtrZdKpfPplkbXcCmIiXQFzQ3fFXn7USXBpZpBHnTFFrM+ vE9IHL9xpiCHFLFt3a1bzdr9H6TZLiOV/Q1Pl/F7I7XNK1LCdJ14+AxfbnIbYBtQ1MIS PLSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JT/l1v+hTANO941RcdPrrNcCCSNAMYx1qZp+59xzz/M=; b=qX0NR5dGkqZ+XLjXLOkK/JMStaS7daEyWK451qtBkPeTaE6fCBezHk8JufgUrrySwD 5EC/cYszII0wpi/4NuihiFGg/cufzcdcEnxwmP0+m8Mww2mQKDKeGXRMuEZmEX3hRNaI TykeLka+euyTl5VIBdlzeQjdlpRPSwhTDj9EU+iCVOY0sqcSjT6Gamkp/fyfrkfLu+JH OvRxbqVdgAQp5yKE5bhAdlyxFjAl056RJYmGbeyYmCcl4vhM5i+lMZZM6pTAH8JaWUwT idXzqGt/059zQaDtTjdyWuE0tnrD2V8OLpPKWwB1YtpfnQMQUqNJ1JGHAcu88M0Grkh3 aXYA== X-Gm-Message-State: ABuFfoi8E5KV9YKPr9S6R8GQWGIWBij6dSewZ6lWyz6W0/dj+2UGwj1+ UHYdnK+92sxtXGN8tLAWpRdQskz8DwY= X-Google-Smtp-Source: ACcGV61k6LOL2gLt0NDtP0g6IKmkJXlcqJAN0ZO+iKmu9vB1dAEYhL1MvOojJKIATv4yNuCh/XRsyQ== X-Received: by 2002:a1c:848c:: with SMTP id g134-v6mr4201452wmd.129.1538033792380; Thu, 27 Sep 2018 00:36:32 -0700 (PDT) From: Bishara AbuHattoum To: qemu-devel@nongnu.org, Michael Roth Date: Thu, 27 Sep 2018 10:36:21 +0300 Message-Id: <20180927073624.17163-5-bishara@daynix.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180927073624.17163-1-bishara@daynix.com> References: <20180927073624.17163-1-bishara@daynix.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::333 Subject: [Qemu-devel] [PATCH 4/7] qga: add --retry-path option for re-initializing channel on failure X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yan Vugenfirer Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Michael Roth This adds an option to instruct the agent to periodically attempt re-opening the communication channel after a channel error has occurred. The main use-case for this is providing an OS-independent way of allowing the agent to survive situations like hotplug/unplug of the communication channel, or initial guest set up where the agent may be installed/started prior to the installation of the channel device's driver. There are nicer ways of implementing this functionality via things like systemd services, but this option is useful for platforms like *BSD/w32. Currently a channel error will result in the GSource for that channel being removed from the GMainLoop, but the main loop continuing to run. That behavior results in a dead loop when --retry-path isn't set, and prevents us from knowing when to attempt re-opening the channel when it is set, so we also force the loop to exit as part of this patch. Signed-off-by: Michael Roth Message-Id: <20171026233054.21133-5-mdroth@linux.vnet.ibm.com> --- qga/main.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 54 insertions(+), 8 deletions(-) diff --git a/qga/main.c b/qga/main.c index d9888bff5f..6a152eb3a7 100644 --- a/qga/main.c +++ b/qga/main.c @@ -58,6 +58,7 @@ #endif #define QGA_SENTINEL_BYTE 0xFF #define QGA_CONF_DEFAULT CONFIG_QEMU_CONFDIR G_DIR_SEPARATOR_S "qemu-ga.co= nf" +#define QGA_RETRY_INTERVAL 5 =20 static struct { const char *state_dir; @@ -86,6 +87,7 @@ typedef struct GAConfig { int daemonize; GLogLevelFlags log_level; int dumpconf; + bool retry_path; } GAConfig; =20 struct GAState { @@ -115,6 +117,7 @@ struct GAState { GAPersistentState pstate; GAConfig *config; int socket_activation; + bool force_exit; }; =20 struct GAState *ga_state; @@ -137,6 +140,7 @@ DWORD WINAPI service_ctrl_handler(DWORD ctrl, DWORD typ= e, LPVOID data, VOID WINAPI service_main(DWORD argc, TCHAR *argv[]); #endif static int run_agent(GAState *s); +static void stop_agent(GAState *s, bool requested); =20 static void init_dfl_pathnames(void) @@ -185,9 +189,7 @@ static void quit_handler(int sig) } g_debug("received signal num %d, quitting", sig); =20 - if (g_main_loop_is_running(ga_state->main_loop)) { - g_main_loop_quit(ga_state->main_loop); - } + stop_agent(ga_state, true); } =20 #ifndef _WIN32 @@ -272,6 +274,10 @@ QEMU_COPYRIGHT "\n" " to list available RPCs)\n" " -D, --dump-conf dump a qemu-ga config file based on current config\n" " options / command-line parameters to stdout\n" +" -r, --retry-path attempt re-opening path if it's unavailable or closed= \n" +" due to an error which may be recoverable in the futur= e\n" +" (virtio-serial driver re-install, serial device hot\n" +" plug/unplug, etc.)\n" " -h, --help display this help and exit\n" "\n" QEMU_HELP_BOTTOM "\n" @@ -665,6 +671,7 @@ static gboolean channel_event_cb(GIOCondition condition= , gpointer data) switch (status) { case G_IO_STATUS_ERROR: g_warning("error reading channel"); + stop_agent(s, false); return false; case G_IO_STATUS_NORMAL: buf[count] =3D 0; @@ -1008,6 +1015,10 @@ static void config_load(GAConfig *config) /* enable all log levels */ config->log_level =3D G_LOG_LEVEL_MASK; } + if (g_key_file_has_key(keyfile, "general", "retry-path", NULL)) { + config->retry_path =3D + g_key_file_get_boolean(keyfile, "general", "retry-path", &gerr= ); + } if (g_key_file_has_key(keyfile, "general", "blacklist", NULL)) { config->bliststr =3D g_key_file_get_string(keyfile, "general", "blacklist", &gerr); @@ -1069,6 +1080,8 @@ static void config_dump(GAConfig *config) g_key_file_set_string(keyfile, "general", "statedir", config->state_di= r); g_key_file_set_boolean(keyfile, "general", "verbose", config->log_level =3D=3D G_LOG_LEVEL_MASK); + g_key_file_set_boolean(keyfile, "general", "retry-path", + config->retry_path); tmp =3D list_join(config->blacklist, ','); g_key_file_set_string(keyfile, "general", "blacklist", tmp); g_free(tmp); @@ -1087,7 +1100,7 @@ static void config_dump(GAConfig *config) =20 static void config_parse(GAConfig *config, int argc, char **argv) { - const char *sopt =3D "hVvdm:p:l:f:F::b:s:t:D"; + const char *sopt =3D "hVvdm:p:l:f:F::b:s:t:Dr"; int opt_ind =3D 0, ch; const struct option lopt[] =3D { { "help", 0, NULL, 'h' }, @@ -1107,6 +1120,7 @@ static void config_parse(GAConfig *config, int argc, = char **argv) { "service", 1, NULL, 's' }, #endif { "statedir", 1, NULL, 't' }, + { "retry-path", 0, NULL, 'r' }, { NULL, 0, NULL, 0 } }; =20 @@ -1151,6 +1165,9 @@ static void config_parse(GAConfig *config, int argc, = char **argv) case 'D': config->dumpconf =3D 1; break; + case 'r': + config->retry_path =3D true; + break; case 'b': { if (is_help_option(optarg)) { qmp_for_each_command(&ga_commands, ga_print_cmd, NULL); @@ -1354,9 +1371,6 @@ static void cleanup_agent(GAState *s) ga_command_state_free(s->command_state); json_message_parser_destroy(&s->parser); } - if (s->channel) { - ga_channel_free(s->channel); - } g_free(s->pstate_filepath); g_free(s->state_filepath_isfrozen); if (s->main_loop) { @@ -1366,7 +1380,7 @@ static void cleanup_agent(GAState *s) ga_state =3D NULL; } =20 -static int run_agent(GAState *s) +static int run_agent_once(GAState *s) { if (!channel_init(s, s->config->method, s->config->channel_path, s->socket_activation ? FIRST_SOCKET_ACTIVATION_FD : = -1)) { @@ -1376,9 +1390,41 @@ static int run_agent(GAState *s) =20 g_main_loop_run(ga_state->main_loop); =20 + if (s->channel) { + ga_channel_free(s->channel); + } + return EXIT_SUCCESS; } =20 +static int run_agent(GAState *s) +{ + int ret =3D EXIT_SUCCESS; + + s->force_exit =3D false; + + do { + ret =3D run_agent_once(s); + if (s->config->retry_path && !s->force_exit) { + g_warning("agent stopped unexpectedly, restarting..."); + sleep(QGA_RETRY_INTERVAL); + } + } while (s->config->retry_path && !s->force_exit); + + return ret; +} + +static void stop_agent(GAState *s, bool requested) +{ + if (!s->force_exit) { + s->force_exit =3D requested; + } + + if (g_main_loop_is_running(s->main_loop)) { + g_main_loop_quit(s->main_loop); + } +} + int main(int argc, char **argv) { int ret =3D EXIT_SUCCESS; --=20 2.17.0 From nobody Tue May 7 20:45:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1538034082737664.4422708529079; Thu, 27 Sep 2018 00:41:22 -0700 (PDT) Received: from localhost ([::1]:34192 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5QvJ-0001Yz-NM for importer@patchew.org; Thu, 27 Sep 2018 03:41:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59324) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5Qqi-0006AR-Ur for qemu-devel@nongnu.org; Thu, 27 Sep 2018 03:36:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g5Qqh-0003uE-3Y for qemu-devel@nongnu.org; Thu, 27 Sep 2018 03:36:36 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:36700) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g5Qqg-0003sc-Ol for qemu-devel@nongnu.org; Thu, 27 Sep 2018 03:36:35 -0400 Received: by mail-wm1-x341.google.com with SMTP id n23-v6so934161wmc.1 for ; Thu, 27 Sep 2018 00:36:34 -0700 (PDT) Received: from bark.daynix ([141.226.163.173]) by smtp.gmail.com with ESMTPSA id y206-v6sm1708129wmg.14.2018.09.27.00.36.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Sep 2018 00:36:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Hif+ZbUqFAjTm9Wnm3ty241o7bWCvVmu0UtMr0D8Yxc=; b=bkdc/1Y2qIICdjvNJEedSx8GG0+8KKOZJOhb4XFCN+CJC8OAqoswFeuEa1S/aoFaak pN9CboDV/6/ZPqYznWLUah8t7C6RwRtQmCUUTflQQskBiSDX5yFZsbkjIxePb1MJKwh5 b2Z5ULYCkabKFYJOtyZBZ2UGkH8vvX/PVNSPYCKLg57OPNB91P5M3JMO9a4JD2WICyB/ Cbs16JEcQxFcwfwKrm6Ut5CAXSGrLH0kXaEwV1m3EVEoKANtvC/Fw2VhZoNoefXi7F+i ULdf0lg4tnsg0srIugqfWN/2VTcBIfeufp1djYTMbrUuWhALiSQPNaPDKKmu3IBI7kSo lA6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Hif+ZbUqFAjTm9Wnm3ty241o7bWCvVmu0UtMr0D8Yxc=; b=aE+f9Fry3qVIRhaWGIihaAoFsIUyiv7wHAu+wJnziCVLHsMhrzk9j5GjRw35TWFicQ +Gmo00t4mVivDPZF+YrSzjswRuslwBVOQJvjk7mPOeTRzaIy2dbvD9Crpqz/xLR/4Fer A0iXNwyrCaa2K8O7ge60MZBG7Y6WTrLvvFkqsmVY02emJJDIbfx56+gsehSloDZ8HdNL Wb61cMHdphY4nd8w/Mr47l+Jbwr6yrXmpWXKdPElHGPE0vDVLWBvB68RhLqPfGrt5qE6 bYboJBFFn2w7RAR52slrGO0yl20jAsL9mGyHaibS64FjfXIOsZVt3x+lrDOkHKE1HGD4 HMaQ== X-Gm-Message-State: ABuFfogvv7gIjhXVnGRIAgjrtfy2gtRXM7nG56+eFxf/hcuhIyntfExD SZkBMe13xYAT61TjF9rOXwMqIg69H1Y= X-Google-Smtp-Source: ACcGV63Vwq8um/AFYL4p/S7EBSEQXt6JSeTyFInSNjQ2tzVPDzrYp+k+BoUwCCX820YqOkVfevxErA== X-Received: by 2002:a1c:d0c8:: with SMTP id h191-v6mr5167386wmg.74.1538033793524; Thu, 27 Sep 2018 00:36:33 -0700 (PDT) From: Bishara AbuHattoum To: qemu-devel@nongnu.org, Michael Roth Date: Thu, 27 Sep 2018 10:36:22 +0300 Message-Id: <20180927073624.17163-6-bishara@daynix.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180927073624.17163-1-bishara@daynix.com> References: <20180927073624.17163-1-bishara@daynix.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 Subject: [Qemu-devel] [PATCH 5/7] qga-win: install service with --retry-path set by default X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yan Vugenfirer Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Michael Roth It's nicer from a management perspective that the agent can survive hotplug/unplug of the channel device, or be started prior to the installation of the channel device's driver without and still be able to resume normal function afterward. On linux there are alternatives like systemd to support this, but on w32 --retry-path is the only option so it makes sense to set it by default when installed as a w32 service. Signed-off-by: Michael Roth Message-Id: <20171026233054.21133-6-mdroth@linux.vnet.ibm.com> --- qga/installer/qemu-ga.wxs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qga/installer/qemu-ga.wxs b/qga/installer/qemu-ga.wxs index f751a7e9f7..64bf90bd85 100644 --- a/qga/installer/qemu-ga.wxs +++ b/qga/installer/qemu-ga.wxs @@ -78,7 +78,7 @@ Account=3D"LocalSystem" ErrorControl=3D"ignore" Interactive=3D"no" - Arguments=3D"-d" + Arguments=3D"-d --retry-path" > --=20 2.17.0 From nobody Tue May 7 20:45:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1538034215332388.4017682899039; Thu, 27 Sep 2018 00:43:35 -0700 (PDT) Received: from localhost ([::1]:34203 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5QxS-0004Ix-5u for importer@patchew.org; Thu, 27 Sep 2018 03:43:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59344) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5Qqn-0006FT-Js for qemu-devel@nongnu.org; Thu, 27 Sep 2018 03:36:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g5Qqj-0003vA-5d for qemu-devel@nongnu.org; Thu, 27 Sep 2018 03:36:39 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:36446) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g5Qqi-0003uJ-SM for qemu-devel@nongnu.org; Thu, 27 Sep 2018 03:36:37 -0400 Received: by mail-wr1-x435.google.com with SMTP id l10-v6so1435419wrp.3 for ; Thu, 27 Sep 2018 00:36:35 -0700 (PDT) Received: from bark.daynix ([141.226.163.173]) by smtp.gmail.com with ESMTPSA id y206-v6sm1708129wmg.14.2018.09.27.00.36.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Sep 2018 00:36:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=30t+y8awsqW1N+nNBmDQ535z74w7vPLBPCGSuxPJPP8=; b=q4yz9NQqklUE9jUfEFydmsEd/HVod6y81+Rtytm3ViA0zcRT0UnE7H9jxS6I+e6CYp g8t/JgISdvdJeCGe+HMkG5Abyj2d2jW4d6zZbxxVM1Ju6UjmMb2fGPuo16B8xC8LED55 zoY+WeXQasNQJ9wWjBbp4m57ve9MrJPFCPED6zXTUx8Ns2HN3yJnipE5zfFSiQRE41cA xc69htiiPrwtkmfwH1WuVLgK7rEWTsTzn4+JcWZW70xRFbtmaOD4CEvTzj4ggD6l3cuD RKqYBW3k69XQzfXpRV6Lv1x4bR5HC8mFDca5TipYa3Qtnr4ct9AUCdHSivAuuxauqEdg Tf9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=30t+y8awsqW1N+nNBmDQ535z74w7vPLBPCGSuxPJPP8=; b=JaU2wTq5conckzjzxT8SXJe1H5bqPhmBLxWTktQFSlivxP+ZKwtQwpmc1DlTd6SKsv c8JAVoPtvtrU2fLm9UhpVFmxuBfLQkOKhk54fBLGs3Y3mrm4cAAIq7S05CsyQfbs0S6h fKyTTFLf7QgZPASJuSuYXSv3hFtxt7xrGDRVsEOmF9JOQshDfA/wDnURRJi9zAzHuUW5 RrUHQwfLIgWWb1m8yW1B1tHZb45PMw5RtT0ZIebvvxYXktVHhgDd4wCPEuoJ+taHVbEM OnB2VkpirEQm4Ce6nMQ58eb8MJiFXc/rM6pzzjqBSz76bYnPoF9/cX9tX6DvZVp0NvbH Jv1Q== X-Gm-Message-State: ABuFfoikk8lrCJOMj3u0r0WrOAx8V88iiU/Eq6p0TjazVTJMFWpuG7KV f95XjHUUmyEx7XyhPHHKSCGc5/hTCm8= X-Google-Smtp-Source: ACcGV62prFUWVKouNqbH0GONVriV67Fs1kiI9F1F/tkMpl09RvBnoXMLj6V2q3EyzayMz299frTShw== X-Received: by 2002:adf:8206:: with SMTP id 6-v6mr7666960wrb.160.1538033794622; Thu, 27 Sep 2018 00:36:34 -0700 (PDT) From: Bishara AbuHattoum To: qemu-devel@nongnu.org, Michael Roth Date: Thu, 27 Sep 2018 10:36:23 +0300 Message-Id: <20180927073624.17163-7-bishara@daynix.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180927073624.17163-1-bishara@daynix.com> References: <20180927073624.17163-1-bishara@daynix.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::435 Subject: [Qemu-devel] [PATCH 6/7] qga-win: report specific error when failing to open channel X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yan Vugenfirer Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Michael Roth Useful in general, but especially now that errors might occur more frequently with --retry-path set. Signed-off-by: Michael Roth Message-Id: <20171026233054.21133-7-mdroth@linux.vnet.ibm.com> Reviewed-by: Marc-Andr=C3=A9 Lureau --- qga/channel-win32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qga/channel-win32.c b/qga/channel-win32.c index b3597a8a0f..c86f4388db 100644 --- a/qga/channel-win32.c +++ b/qga/channel-win32.c @@ -302,7 +302,8 @@ static gboolean ga_channel_open(GAChannel *c, GAChannel= Method method, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING | FILE_FLAG_OVERLAPPED, = NULL); if (c->handle =3D=3D INVALID_HANDLE_VALUE) { - g_critical("error opening path %s", newpath); + g_critical("error opening path %s: %s", newpath, + g_win32_error_message(GetLastError())); return false; } =20 --=20 2.17.0 From nobody Tue May 7 20:45:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 153803407823895.22138536580826; Thu, 27 Sep 2018 00:41:18 -0700 (PDT) Received: from localhost ([::1]:34191 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5QvE-0001Ws-Th for importer@patchew.org; Thu, 27 Sep 2018 03:41:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59365) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5Qqs-0006JI-1I for qemu-devel@nongnu.org; Thu, 27 Sep 2018 03:36:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g5Qqn-00044V-K0 for qemu-devel@nongnu.org; Thu, 27 Sep 2018 03:36:45 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:50235) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g5Qqj-0003uo-9R for qemu-devel@nongnu.org; Thu, 27 Sep 2018 03:36:40 -0400 Received: by mail-wm1-x32d.google.com with SMTP id s12-v6so4786916wmc.0 for ; Thu, 27 Sep 2018 00:36:37 -0700 (PDT) Received: from bark.daynix ([141.226.163.173]) by smtp.gmail.com with ESMTPSA id y206-v6sm1708129wmg.14.2018.09.27.00.36.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Sep 2018 00:36:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qrdtANaJOjIgQ22uqNGOCzQnsp0awSqqWr3HcemFVxU=; b=gMee553haaENoQz4fRe6+GWrZl3GHlf2q5xFGHqHjHVG+xqCj8XbDffD9tMNbaqpYx bRKrnQPO4cEDFDjjuDA87hu97dMrIbpGyNxgr0g+eh827R5Y9gvmL8dtbeAVH4LwU8be Q74caxv6icjNYHYaH1GAAYlR04qt5b2GcBKXBot2yH4P00X1R9K/e3B1S5AuxJjfHvOE keGcXwgf4Cey01xLlb7x+oDOgmU7xrj6LhdMLz2hxwRAIlhptfBU4X61bhioG/TvM48d QaQl4wV1MaAo2UmbnnBxqxCTHnwLNM6BFKERiZ+WQIiBOqaN3B8SpBLRIS0pFI31ZANF JNow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qrdtANaJOjIgQ22uqNGOCzQnsp0awSqqWr3HcemFVxU=; b=avAhhI15L/5iAZ1eA0/aL7QDFCeblrHy5bP58tKV5Q5rcfZc/JIL+kyd/4WXe30t6x Y/E/ekbMAmE0xjRaZiOu9zoWSl1IlWJ80WDyHxrg4BgZ6qUGh3SIpFBhCqlHvx9H+7Dp +aDqYS1xp6FM+ayAc4CQF0/BaKV6HQVIB1zPg9VCFPKYqfEgWnWhnEBR8ti0+J+dF0aU FpSoxnMRF1+T+IaeVDhdHax0s82s8Lk2xHzp4kj8DHZtZPab36m9WXYUrHOjU3PL9oJu a0spTLKO6zT6AjwB6nIJ6kGE7IT3AajaU0/bMEWILwiSqSMJ8HVzZiTOU/iZ+BypNkRC Rl9A== X-Gm-Message-State: ABuFfojuFH3jApHZRt3Ms7mdEguCuG8N5Oy0MvWa6hnUaKozVOobPTka tFQUG9Pz6edXxHCWYmZJBTq1AJhuYrM= X-Google-Smtp-Source: ACcGV60nljOYu5XcCXb8nd6pSwcj8n+eF0mN+eM8e7bMWcw0n9GkyxiGw1Nqu17tOiKQuKbBnZfI7g== X-Received: by 2002:a1c:c187:: with SMTP id r129-v6mr6757756wmf.13.1538033795812; Thu, 27 Sep 2018 00:36:35 -0700 (PDT) From: Bishara AbuHattoum To: qemu-devel@nongnu.org, Michael Roth Date: Thu, 27 Sep 2018 10:36:24 +0300 Message-Id: <20180927073624.17163-8-bishara@daynix.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180927073624.17163-1-bishara@daynix.com> References: <20180927073624.17163-1-bishara@daynix.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32d Subject: [Qemu-devel] [PATCH 7/7] qga-win: changing --retry-path option behavior X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yan Vugenfirer Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Currently whenever the qemu-ga's service doesn't find the virtio-serial the run_agent() loops in a QGA_RETRY_INTERVAL (default 5 seconds) intervals and try to restart the qemu-ga which causes a synchronous loop. Changed to wait and listen for the serial events by registering for notifications a proper serial event handler that deals with events: DBT_DEVICEARRIVAL indicates that the device has been inserted and is available DBT_DEVICEREMOVECOMPLETE indicates that the devive has been removed Which allow us to determine when the channel path is available for the qemu-ga to restart. Signed-off-by: Bishara AbuHattoum Signed-off-by: Sameeh Jubran --- qga/main.c | 101 +++++++++++++++++++++++++++++++++++++++++++- qga/service-win32.h | 4 ++ 2 files changed, 104 insertions(+), 1 deletion(-) diff --git a/qga/main.c b/qga/main.c index 6a152eb3a7..215dcb36f1 100644 --- a/qga/main.c +++ b/qga/main.c @@ -34,6 +34,7 @@ #include "qemu/systemd.h" #include "qemu-version.h" #ifdef _WIN32 +#include #include "qga/service-win32.h" #include "qga/vss-win32.h" #endif @@ -101,6 +102,8 @@ struct GAState { bool logging_enabled; #ifdef _WIN32 GAService service; + HANDLE channel_available_event; + HANDLE stop_event; #endif bool delimit_response; bool frozen; @@ -137,6 +140,7 @@ static const char *ga_freeze_whitelist[] =3D { #ifdef _WIN32 DWORD WINAPI service_ctrl_handler(DWORD ctrl, DWORD type, LPVOID data, LPVOID ctx); +DWORD WINAPI handle_serial_device_events(DWORD type, LPVOID data); VOID WINAPI service_main(DWORD argc, TCHAR *argv[]); #endif static int run_agent(GAState *s); @@ -729,6 +733,36 @@ static gboolean channel_init(GAState *s, const gchar *= method, const gchar *path, } =20 #ifdef _WIN32 +DWORD WINAPI handle_serial_device_events(DWORD type, LPVOID data) +{ + DWORD ret =3D NO_ERROR; + PDEV_BROADCAST_HDR broadcast_header =3D (PDEV_BROADCAST_HDR)data; + + if (broadcast_header->dbch_devicetype =3D=3D DBT_DEVTYP_DEVICEINTERFAC= E) { + switch (type) { + /* Device inserted */ + case DBT_DEVICEARRIVAL: + /* Start QEMU-ga's service */ + if (!SetEvent(ga_state->channel_available_event)) { + ret =3D GetLastError(); + } + break; + /* Device removed */ + case DBT_DEVICEQUERYREMOVE: + case DBT_DEVICEREMOVEPENDING: + case DBT_DEVICEREMOVECOMPLETE: + /* Stop QEMU-ga's service */ + if (!ResetEvent(ga_state->channel_available_event)) { + ret =3D GetLastError(); + } + break; + default: + ret =3D ERROR_CALL_NOT_IMPLEMENTED; + } + } + return ret; +} + DWORD WINAPI service_ctrl_handler(DWORD ctrl, DWORD type, LPVOID data, LPVOID ctx) { @@ -740,9 +774,13 @@ DWORD WINAPI service_ctrl_handler(DWORD ctrl, DWORD ty= pe, LPVOID data, case SERVICE_CONTROL_STOP: case SERVICE_CONTROL_SHUTDOWN: quit_handler(SIGTERM); + SetEvent(ga_state->stop_event); service->status.dwCurrentState =3D SERVICE_STOP_PENDING; SetServiceStatus(service->status_handle, &service->status); break; + case SERVICE_CONTROL_DEVICEEVENT: + handle_serial_device_events(type, data); + break; =20 default: ret =3D ERROR_CALL_NOT_IMPLEMENTED; @@ -769,10 +807,25 @@ VOID WINAPI service_main(DWORD argc, TCHAR *argv[]) service->status.dwServiceSpecificExitCode =3D NO_ERROR; service->status.dwCheckPoint =3D 0; service->status.dwWaitHint =3D 0; + DEV_BROADCAST_DEVICEINTERFACE notification_filter; + ZeroMemory(¬ification_filter, sizeof(notification_filter)); + notification_filter.dbcc_devicetype =3D DBT_DEVTYP_DEVICEINTERFACE; + notification_filter.dbcc_size =3D sizeof(DEV_BROADCAST_DEVICEINTERFACE= ); + notification_filter.dbcc_classguid =3D GUID_VIOSERIAL_PORT; + + service->device_notification_handle =3D + RegisterDeviceNotification(service->status_handle, + ¬ification_filter, DEVICE_NOTIFY_SERVICE_HANDLE); + if (!service->device_notification_handle) { + g_critical("Failed to register device notification handle!\n"); + return; + } SetServiceStatus(service->status_handle, &service->status); + ResetEvent(ga_state->stop_event); =20 run_agent(ga_state); =20 + UnregisterDeviceNotification(service->device_notification_handle); service->status.dwCurrentState =3D SERVICE_STOPPED; SetServiceStatus(service->status_handle, &service->status); } @@ -1360,12 +1413,32 @@ static GAState *initialize_agent(GAConfig *config, = int socket_activation) =20 s->config =3D config; s->socket_activation =3D socket_activation; + +#ifdef _WIN32 + s->channel_available_event =3D CreateEvent(NULL, TRUE, FALSE, + TEXT("ChannelAvailableEvent")= ); + if (s->channel_available_event =3D=3D NULL) { + g_critical("CreateEvent failed"); + return NULL; + } + s->stop_event =3D CreateEvent(NULL, TRUE, FALSE, + TEXT("StopEvent")); + if (s->stop_event =3D=3D NULL) { + g_critical("CreateEvent failed"); + return NULL; + } +#endif + ga_state =3D s; return s; } =20 static void cleanup_agent(GAState *s) { +#ifdef _WIN32 + CloseHandle(s->channel_available_event); + CloseHandle(s->stop_event); +#endif if (s->command_state) { ga_command_state_cleanup_all(s->command_state); ga_command_state_free(s->command_state); @@ -1397,6 +1470,32 @@ static int run_agent_once(GAState *s) return EXIT_SUCCESS; } =20 +static void wait_for_channel_availability(GAState *s) +{ + g_warning("waiting for channel path..."); +#ifndef _WIN32 + sleep(QGA_RETRY_INTERVAL); +#else + DWORD dwWaitResult; + + HANDLE lpHandles[2] =3D { s->channel_available_event, s->stop_event }; + + dwWaitResult =3D WaitForMultipleObjects(2, lpHandles, false, INFINITE); + + switch (dwWaitResult) { + case WAIT_OBJECT_0: + break; + case (WAIT_OBJECT_0 + 1): + g_warning("service stopped"); + break; + case WAIT_TIMEOUT: + break; + default: + g_critical("WaitForMultipleObjects failed"); + } +#endif +} + static int run_agent(GAState *s) { int ret =3D EXIT_SUCCESS; @@ -1407,7 +1506,7 @@ static int run_agent(GAState *s) ret =3D run_agent_once(s); if (s->config->retry_path && !s->force_exit) { g_warning("agent stopped unexpectedly, restarting..."); - sleep(QGA_RETRY_INTERVAL); + wait_for_channel_availability(s); } } while (s->config->retry_path && !s->force_exit); =20 diff --git a/qga/service-win32.h b/qga/service-win32.h index 89e99dfede..7b16d69b57 100644 --- a/qga/service-win32.h +++ b/qga/service-win32.h @@ -20,9 +20,13 @@ #define QGA_SERVICE_NAME "qemu-ga" #define QGA_SERVICE_DESCRIPTION "Enables integration with QEMU machine em= ulator and virtualizer." =20 +static const GUID GUID_VIOSERIAL_PORT =3D { 0x6fde7521, 0x1b65, 0x48ae, +{ 0xb6, 0x28, 0x80, 0xbe, 0x62, 0x1, 0x60, 0x26 } }; + typedef struct GAService { SERVICE_STATUS status; SERVICE_STATUS_HANDLE status_handle; + HDEVNOTIFY device_notification_handle; } GAService; =20 int ga_install_service(const char *path, const char *logfile, --=20 2.17.0