Re: [PATCH 05/28] kvm tools: 64-bit tidy; use PRIx64 when printf'ing

Ingo Molnar
2011-12-07T08:16:02Z

* Matt Evans <matt@ozlabs.org> wrote:

> >> [...] I haven't looked closely at Matt's
> >> patches, but it should be possible to use [un]signed long long
> >> for the u64/s64 types, I would think.
> >
> > In tools/kvm/ we are using our own u64/s64 definitions, not
> > glibc's, so i think it should be fine - as long as we don't pick
> > up int-l64.h accidentally via the
> > arch/powerpc/include/asm/types.h exception for user-space.
>
> That's what's happening here; we're __powerpc64__ and
> !__KERNEL__, tools/kvm/include/linux/types.h includes
> asm/types.h so gets the int-l64.h definition of __u64, as
> above. :/
>
> builtin-run.c:389: error: format `%llx' expects type `long
> long unsigned int', but argument 2 has type `u64'

So either define __KERNEL__ or patch a __NEW_USERSPACE__ define
into power/asm/types.h and use it - if the PowerPC folks agree
with that approach.

Sane userspace should not be prevented from using the same sane
types the kernel is already using :-)

Thanks,

Ingo