[libvirt] [PATCH] Misc win32 build fixes

Daniel P. Berrange berrange at redhat.com
Wed Oct 7 14:08:24 UTC 2009


On Wed, Oct 07, 2009 at 03:56:12PM +0200, Daniel Veillard wrote:
> On Wed, Oct 07, 2009 at 11:42:19AM +0100, Daniel P. Berrange wrote:
> > * daemon/Makefile.am: Fix missing sasl rule
> > * src/datatypes.c: Add unistd.h to avoid gnulib bug
> > * src/util/cgroup.c: Disable mntent if not available
> > ---
> 
>   ACK, also unification of type we use long long in libvirt to denotate
> 64 bits ints, it's actually the largest change in that patch.

Opps, I should have mentioned why I did that too...

The PRIi64  constants is intended to expand to the OS specific printf
format required for a 64 bit integer type. All Win32 runtimes have 
broken 64-bit integer printf support - their definition of PRIi64 
in fact wants a type of 'long' which is only 32bits. libvirt though
uses GNULIB which provides a replacement printf impl which works
properly, but  it does not replace the PRIi64 constant which still
refers to the Microsoft impl's requirements.  Thus we switch to just
using the fixed %llu which we know GNULIB guarentees to support, so
does not need "portability" constants.  Of course using int64_t 
with %llu then generates a warning, unless you cast to unsigned long
long. So in the end the simple solution is just to say

  %llu  and unsigned long long    

everywhere, and ignore all this portability stuff which is not in fact
portable or reliable

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list