From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>,
Ian Campbell <Ian.Campbell@citrix.com>
Subject: [PATCH 3/5] xl: Abolish vncviewer_child_report
Date: Wed, 19 Mar 2014 14:28:52 +0000 [thread overview]
Message-ID: <1395239334-19579-4-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1395239334-19579-1-git-send-email-ian.jackson@eu.citrix.com>
vncviewer_child_report was very similar to console_child_report.
We can abolish vncviewer_child_report by adding an xlchildnum
parameter to console_child_report.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
---
tools/libxl/xl_cmdimpl.c | 45 ++++++++++++++++-----------------------------
1 file changed, 16 insertions(+), 29 deletions(-)
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 0c2eca3..d61d301 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -205,29 +205,29 @@ static uint32_t find_domain(const char *p)
return domid;
}
-static int vncviewer(uint32_t domid, int autopass)
+static void console_child_report(xlchildnum child)
{
- libxl_vncviewer_exec(ctx, domid, autopass);
- fprintf(stderr, "Unable to execute vncviewer\n");
- return 1;
-}
-
-static void vncviewer_child_report(void)
-{
- if (xl_child_pid(child_vncviewer)) {
+ if (xl_child_pid(child)) {
int status;
- pid_t got = xl_waitpid(child_vncviewer, &status, 0);
+ pid_t got = xl_waitpid(child, &status, 0);
if (got < 0)
- perror("xl: warning, failed to waitpid for vncviewer child");
+ fprintf(stderr, "xl: warning, failed to waitpid for %s: %s\n",
+ children[child].description, strerror(errno));
else if (status)
- xl_report_child_exitstatus(XTL_ERROR, child_vncviewer,
- got, status);
+ xl_report_child_exitstatus(XTL_ERROR, child, got, status);
}
}
+static int vncviewer(uint32_t domid, int autopass)
+{
+ libxl_vncviewer_exec(ctx, domid, autopass);
+ fprintf(stderr, "Unable to execute vncviewer\n");
+ return 1;
+}
+
static void autoconnect_vncviewer(uint32_t domid, int autopass)
{
- vncviewer_child_report();
+ console_child_report(child_vncviewer);
pid_t pid = xl_fork(child_vncviewer, "vncviewer child");
if (pid)
@@ -1983,19 +1983,6 @@ static int freemem(uint32_t domid, libxl_domain_build_info *b_info)
return ERROR_NOMEM;
}
-static void console_child_report(void)
-{
- if (xl_child_pid(child_console)) {
- int status;
- pid_t got = xl_waitpid(child_console, &status, 0);
- if (got < 0)
- perror("xl: warning, failed to waitpid for console child");
- else if (status)
- xl_report_child_exitstatus(XTL_ERROR, child_console,
- got, status);
- }
-}
-
static void autoconnect_console(libxl_ctx *ctx_ignored,
libxl_event *ev, void *priv)
{
@@ -2003,7 +1990,7 @@ static void autoconnect_console(libxl_ctx *ctx_ignored,
libxl_event_free(ctx, ev);
- console_child_report();
+ console_child_report(child_console);
pid_t pid = xl_fork(child_console, "console child");
if (pid)
@@ -2461,7 +2448,7 @@ out:
free(config_data);
- console_child_report();
+ console_child_report(child_console);
if (deathw)
libxl_evdisable_domain_death(ctx, deathw);
--
1.7.10.4
next prev parent reply other threads:[~2014-03-19 14:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-19 14:28 [PATCH 0/5] xl: console error handling improvements Ian Jackson
2014-03-19 14:28 ` [PATCH 1/5] xl: remove needless error checking from calls to xl_fork Ian Jackson
2014-03-21 13:47 ` Ian Campbell
2014-03-19 14:28 ` [PATCH 2/5] xl: Introduce children[].description and xl_report_child_exitstatus Ian Jackson
2014-03-21 13:47 ` Ian Campbell
2014-03-19 14:28 ` Ian Jackson [this message]
2014-03-21 13:48 ` [PATCH 3/5] xl: Abolish vncviewer_child_report Ian Campbell
2014-03-21 14:33 ` [PATCH 3/5] xl: Abolish vncviewer_child_report [and 1 more messages] Ian Jackson
2014-03-19 14:28 ` [PATCH 4/5] xl: Remove clone-and-hack in do_daemonize Ian Jackson
2014-03-21 13:49 ` Ian Campbell
2014-03-19 14:28 ` [PATCH 5/5] xl: console connection: Print errno value from exec Ian Jackson
2014-03-21 13:52 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1395239334-19579-4-git-send-email-ian.jackson@eu.citrix.com \
--to=ian.jackson@eu.citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).