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] Casting 64-bit pointers to integers

To: Michael David Crawford <mdc@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-devel] Casting 64-bit pointers to integers
From: Michael David Crawford <mdc@xxxxxxxxx>
Date: Fri, 22 May 2009 02:53:38 -0700
Cc:
Delivery-date: Fri, 22 May 2009 02:54:08 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20090522094141.GH10166@xxxxxxxxxxxxxxxxxxxxxxxxx>
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>
Organization: Prgmr.com
References: <4A1670BB.90101@xxxxxxxxx> <20090522094141.GH10166@xxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.21 (Macintosh/20090302)
Samuel Thibault wrote:
intptr_t/uintptr_t is there for this.

In tools/xenpmd/acpi-events.c, which is in the git sources but doesn't seem to be in the 3.4 sources, there are two returns from acpi_events_thread which cast ints to void*'s. These break the compile on 64-bit.

One of the ints is a socket_fd, the other is the result from a connect system call.

I got it to compile at first by doing something like this:

  return (void*)(unsigned long long)socket_fd

But what would be better is

  return (void*)(uintptr_t)socket_fd

If you were to just make socket_fd a uintptr_t, it would lose precision when you passed it to connect. You could explicitly cast it to an int there, I suppose.

Mike

--
Michael David Crawford
mdc@xxxxxxxxx

   prgmr.com - We Don't Assume You Are Stupid.

      Xen-Powered Virtual Private Servers: http://prgmr.com/xen

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

<Prev in Thread] Current Thread [Next in Thread>