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

Re: [libvirt] [PATCH] openvz: Fix wordsize on 64 bit architectures



On Tue, Jun 19, 2012 at 04:46:18PM -0600, Eric Blake wrote:
> On 06/19/2012 04:40 PM, Eric Blake wrote:
> > On 06/19/2012 01:11 AM, Guido Günther wrote:
> >> On Mon, Jun 18, 2012 at 03:08:39PM -0600, Eric Blake wrote:
> >>>> On 06/17/2012 11:18 AM, Guido Günther wrote:
> >>>>>> The word size there is 64 bit not 8.
> > 
> >>>> Do we ever compile openvz on any platform where sizeof(int) = 4?
> >>>> Shouldn't this really be checking sizeof(long)?
> >> Or the actual pointer size? Patch attached.
> > 
> > Well, on the new i32 kernel ABI for 64-bit platforms, sizeof(void*)==4
> > while sizeof(long)==8; on the other hand, for mingw64, sizeof(void*)==8
> > while sizeof(long)==4.  You can't win for all platforms, but for the
> > case of openvz, it seems like we are more likely to be compiled on Linux
> > where sizeof(long) may indeed be the better choice.
> > 
> > But I'm okay with your patch to use void*, since the i32 ABI is not
> > popular yet.
> 
> Correction - the x32 ABI; as mentioned here:
> http://kernelnewbies.org/LinuxChanges#head-ec7868ff102658ddea67d09dcedb4a9cb9c60c81
> 
> has sizeof(long)==4 to match sizeof(void*), so sizeof(void*) is
> reasonable after all.
> 
> > 
> >> +++ b/src/openvz/openvz_conf.c
> >> @@ -195,7 +195,7 @@ virCapsPtr openvzCapsInit(void)
> >>      if ((guest = virCapabilitiesAddGuest(caps,
> >>                                           "exe",
> >>                                           utsname.machine,
> >> -                                         sizeof(int) == 4 ? 32 : 64,
> >> +                                         sizeof(void*) == 4 ? 32 : 64,
> > 
> > ACK.
> 
> Thus void* really is better than long here.
Pushed. Thanks.
 -- Guido


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