WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-tools

[Xen-tools] [PATCH] Make xenconsole more friendly when invoked directly

To: Xen Tools <xen-tools@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-tools] [PATCH] Make xenconsole more friendly when invoked directly
From: Anthony Liguori <aliguori@xxxxxxxxxx>
Date: Wed, 10 Aug 2005 11:37:39 -0500
Delivery-date: Wed, 10 Aug 2005 16:36:11 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-tools-request@lists.xensource.com?subject=help>
List-id: Xen control tools developers <xen-tools.lists.xensource.com>
List-post: <mailto:xen-tools@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-tools>, <mailto:xen-tools-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-tools>, <mailto:xen-tools-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-tools-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050317)
Signed-off-by: Anthony Liguori <aliguori@xxxxxxxxxx>

Regards,

Anthony Liguori


# HG changeset patch
# User anthony@xxxxxxxxxxxxxxxxxxxxxxxxx
# Node ID fcc272a4f74bfc51f9068867de02a3525b3121d1
# Parent  49671266459c22862ce878a0cb4386905ebac607
Even though xenconsole should not be invoked directly, make it more 
user-friendly for those that do invoke it directly.

diff -r 49671266459c -r fcc272a4f74b tools/console/client/main.c
--- a/tools/console/client/main.c       Wed Aug 10 15:14:50 2005
+++ b/tools/console/client/main.c       Wed Aug 10 16:34:38 2005
@@ -162,14 +162,11 @@
        struct termios attr;
        int domid;
        int xc_handle;
-       char *sopt = "hf:pc";
+       char *sopt = "h";
        int ch;
        int opt_ind=0;
        struct option lopt[] = {
                { "help",    0, 0, 'h' },
-               { "file",    1, 0, 'f' },
-               { "pty",     0, 0, 'p' },
-               { "ctty",    0, 0, 'c' },
                { 0 },
 
        };
@@ -178,6 +175,7 @@
        int spty;
        unsigned int len = 0;
        struct xs_handle *xs;
+       char *end;
 
        while((ch = getopt_long(argc, argv, sopt, lopt, &opt_ind)) != -1) {
                switch(ch) {
@@ -195,7 +193,13 @@
                exit(EINVAL);
        }
        
-       domid = atoi(argv[optind]);
+       domid = strtol(argv[optind], &end, 10);
+       if (end && *end) {
+               fprintf(stderr, "Invalid DOMID `%s'\n", argv[optind]);
+               fprintf(stderr, "Try `%s --help' for more information.\n",
+                       argv[0]);
+               exit(EINVAL);
+       }
 
        xs = xs_daemon_open();
        if (xs == NULL) {
@@ -211,7 +215,11 @@
 
        snprintf(path, sizeof(path), "/console/%d/tty", domid);
        str_pty = xs_read(xs, path, &len);
-       if (str_pty == NULL) {
+       /* FIXME consoled currently does not assume domain-0 doesn't have a
+          console which is good when we break domain-0 up.  To keep us
+          user friendly, we'll bail out here since no data will ever show
+          up on domain-0. */
+       if (domid == 0 || str_pty == NULL) {
                err(errno, "Could not read tty from store");
        }
        spty = open(str_pty, O_RDWR | O_NOCTTY);
_______________________________________________
Xen-tools mailing list
Xen-tools@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-tools
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-tools] [PATCH] Make xenconsole more friendly when invoked directly, Anthony Liguori <=