Skip to contentSkip to conversation

libxenlight: add console command

PATCH New Tomasz Wroblewski 1 participant 1 message Nov 27, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxenlight: add console command

Resending as attachment because of bad line endings apparently

tools/libxl/libxl.c +18 -0
diff -r d7d77bace286 tools/libxl/libxl.c
@@ -468,6 +468,24 @@
     if (rc < 0) {
         XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_domain_destroy failed for %d", domid);
         return -1;
+    }
+    return 0;
+}
+
+int libxl_console_attach(struct libxl_ctx *ctx, uint32_t domid, int cons_num)
+{
+    struct stat st;
+    const char *XENCONSOLE = "/usr/lib/xen/bin/xenconsole";
+    char *cmd = NULL;
+
+    if (stat(XENCONSOLE, &st) != 0) {
+        XL_LOG(ctx, XL_LOG_ERROR, "could not access %s", XENCONSOLE);
+        return ERROR_FAIL;
+    }
+
+    cmd = libxl_sprintf(ctx, "%s %d --num %d", XENCONSOLE, domid, cons_num);
+    if (system(cmd) != 0) {
+        return ERROR_FAIL;
     }
     return 0;
 }
tools/libxl/libxl.h +2 -0
diff -r d7d77bace286 tools/libxl/libxl.h
@@ -266,6 +266,8 @@
 int libxl_domain_pause(struct libxl_ctx *ctx, uint32_t domid);
 int libxl_domain_unpause(struct libxl_ctx *ctx, uint32_t domid);
 
+int libxl_console_attach(struct libxl_ctx *ctx, uint32_t domid, int cons_num);
+
 struct libxl_dominfo * libxl_domain_list(struct libxl_ctx *ctx, int *nb_domain);
 xc_dominfo_t * libxl_domain_infolist(struct libxl_ctx *ctx, int *nb_domain);
 
tools/libxl/xl.c +52 -0

71 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel