[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 05/12] util/oslib-win32: add qemu_get_host_physmem impleme
From: |
Daniel P . Berrangé |
Subject: |
Re: [PATCH v2 05/12] util/oslib-win32: add qemu_get_host_physmem implementation |
Date: |
Wed, 22 Jul 2020 12:38:21 +0100 |
User-agent: |
Mutt/1.14.5 (2020-06-23) |
On Wed, Jul 22, 2020 at 12:33:47PM +0100, Alex Bennée wrote:
>
> Stefan Weil <sw@weilnetz.de> writes:
>
> > Am 22.07.20 um 08:28 schrieb Alex Bennée:
> >
> >> It seems GetPhysicallyInstalledSystemMemory isn't available in the
> >> MinGW headers so we have to declare it ourselves. Compile tested only.
> >
> >
> > It is available, at least for Mingw-w64 which I also use for cross
> > builds on Debian, but is only included with _WIN32_WINNT >= 0x0601.
> >
> > Currently we set _WIN32_WINNT to 0x0600.
>
> That would explain why some people see things working if they build with
> visual studio (which I presume has a higher setting). We could just wrap
> the body of the function in:
No, that's not how it works. We define _WIN32_WINNT in qemu/osdep.h,
and this causes the Windows headers to hide any functions that post-date
that version.
This is similar to how you might set _POSIX_C_SOURCE / _XOPEN_SOURCE
to control UNIX header visibility.
IOW, the use of visual studio shouldn't affect it.
> #if (_WIN32_WINNT >= 0x0601)
>
> much like in commands-win32.c?
>
> Of course it wouldn't even be compile tested (I used the fedora docker
> image). We should probably clean up the test-mingw code to work with
> both the fedora and debian-w[32|64] images.
I'd just go for GlobalMemoryStatusEx like Stefan suggests. We use this
in libvirt and GNULIB already and it does the job.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
- [PATCH v2 04/12] util: add qemu_get_host_physmem utility function, (continued)
- [PATCH v2 04/12] util: add qemu_get_host_physmem utility function, Alex Bennée, 2020/07/22
- [PATCH v2 03/12] semihosting: don't send the trailing '\0', Alex Bennée, 2020/07/22
- [PATCH v2 06/12] accel/tcg: better handle memory constrained systems, Alex Bennée, 2020/07/22
- [PATCH v2 05/12] util/oslib-win32: add qemu_get_host_physmem implementation, Alex Bennée, 2020/07/22
- Re: [PATCH v2 05/12] util/oslib-win32: add qemu_get_host_physmem implementation, Yonggang Luo, 2020/07/22
[PATCH v2 08/12] linux-user: don't use MAP_FIXED in pgd_find_hole_fallback, Alex Bennée, 2020/07/22
[PATCH v2 09/12] tests/docker: fix update command due to python3 str/bytes distinction, Alex Bennée, 2020/07/22
[PATCH v2 10/12] tests/docker: fix binfmt_misc image building, Alex Bennée, 2020/07/22
[PATCH v2 07/12] target/i386: floatx80: avoid compound literals in static initializers, Alex Bennée, 2020/07/22