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

Re: [Xen-devel] Casting 64-bit pointers to integers


  • To: Michael David Crawford <mdc@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
  • 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
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

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


 


Rackspace

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