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-devel

Re: [Xen-devel] xl: Enable 'xl console' in 'x86_64'

To: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Subject: Re: [Xen-devel] xl: Enable 'xl console' in 'x86_64'
From: Yu Zhiguo <yuzg@xxxxxxxxxxxxxx>
Date: Thu, 29 Apr 2010 10:38:52 +0800
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Delivery-date: Wed, 28 Apr 2010 19:39:07 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4BD856F6.4010503@xxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <4BD80DF4.6000804@xxxxxxxxxxxxxx> <4BD856F6.4010503@xxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 3.0a1 (Windows/2008050715)
Hi Jeremy

Jeremy Fitzhardinge wrote:
>>  
>> +    if (uname(&utsbuf) != -1) {
>> +        if (!strcmp(utsbuf.machine, "x86_64") || !strcmp(utsbuf.machine, 
>> "ia64"))
>> +            XENCONSOLE = "/usr/lib64/xen/bin/xenconsole";
>> +    }
>>   
> 
> Won't this fail if the tools were build 32bit, but being run on a 64bit
> machine?  Why not just look in both places?  Or fix the xenconsole to
> install in /usr/lib regardless of architecture (it isn't a library, so
> nothing will care about its architecture).

Thanks for you reply. I think just look up both location is better.
Please refer to the following.

-------------

'xl console' cannot be used on arch 'x86_64',
because the path of 'xenconsole' is wrong.
Fix this bug.

Signed-off-by: Yu Zhiguo <yuzg@xxxxxxxxxxxxxx>

diff -r 9a1d7caa2024 -r 49176e864ca7 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Mon Apr 26 12:13:23 2010 +0100
+++ b/tools/libxl/libxl.c       Thu Apr 29 18:36:28 2010 +0800
@@ -741,15 +741,19 @@
 {
     struct stat st;
     const char *XENCONSOLE = "/usr/lib/xen/bin/xenconsole";
+    const char *XENCONSOLE64 = "/usr/lib64/xen/bin/xenconsole";
     char *cmd;
 
-    if (stat(XENCONSOLE, &st) != 0) {
-        XL_LOG(ctx, XL_LOG_ERROR, "could not access %s", XENCONSOLE);
+    if (!stat(XENCONSOLE, &st)) {
+        cmd = libxl_sprintf(ctx, "%s %d --num %d", XENCONSOLE, domid, 
cons_num);
+        return (system(cmd) != 0) ? ERROR_FAIL : 0;
+    } else if (!stat(XENCONSOLE64, &st)) {
+        cmd = libxl_sprintf(ctx, "%s %d --num %d", XENCONSOLE64, domid, 
cons_num);
+        return (system(cmd) != 0) ? ERROR_FAIL : 0;
+    } else {
+        XL_LOG(ctx, XL_LOG_ERROR, "could not access %s and %s", XENCONSOLE, 
XENCONSOLE64);
         return ERROR_FAIL;
     }
-
-    cmd = libxl_sprintf(ctx, "%s %d --num %d", XENCONSOLE, domid, cons_num);
-    return (system(cmd) != 0) ? ERROR_FAIL : 0;
 }
 
 static char ** libxl_build_device_model_args(struct libxl_ctx *ctx,


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel