[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:41:16 +0100 |
User-agent: |
Mutt/1.14.5 (2020-06-23) |
On Wed, Jul 22, 2020 at 12:31:06PM +0100, Alex Bennée wrote:
>
> Stefan Weil <sw@weilnetz.de> writes:
>
> > Am 22.07.20 um 12:32 schrieb 罗勇刚(Yonggang Luo):
> >
> >> I would suggest use loadLibrary to retrieve the function, if not
> >> available, then return 0 (For Win Xp and Vista);
> >
> >
> > Maybe using GlobalMemoryStatusEx is a better alternative. It is
> > available since XP.
>
> I would welcome an alternative patch. I have no way to test if it works
> anyway.
Something like this should work:
LPMEMORYSTATUSEX info = {
.dwLength = sizeof(LPMEMORYSTATUSEX),
};
if (!GlobalMemoryStatusEx(&info)) {
...error report...
}
return info.ullTotalPhys;
(or ullAvailPhys for current free memory)
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 :|
- Re: [PATCH v2 06/12] accel/tcg: better handle memory constrained systems, (continued)
[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
[PATCH v2 12/12] linux-user: fix clock_nanosleep(), Alex Bennée, 2020/07/22