[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] xl: Abolish vncviewer_child_report



commit 242e0ee7922dbce4b9866fb2ec65254e174d717c
Author:     Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
AuthorDate: Mon Oct 14 16:20:20 2013 +0100
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Fri Mar 21 14:35:52 2014 +0000

    xl: Abolish vncviewer_child_report
    
    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@xxxxxxxxxxxxx>
    Acked-by: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
---
 tools/libxl/xl_cmdimpl.c |   45 ++++++++++++++++-----------------------------
 1 files 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);
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.