The qemu_oom_check() function, which we define in both oslib-posix.c
and oslib-win32.c, is now used only locally in that file; make it
static.
Signed-off-by: Peter Maydell
---
include/qemu-common.h | 2 --
util/oslib-posix.c| 2 +-
util/oslib-win32.c| 2 +-
3 files changed, 2 insertions(
qemu_oom_check() is a function which essentially says "if you pass me
a NULL pointer then print a message then abort()". On POSIX systems
the message includes strerror(errno); on Windows it includes the
GetLastError() error value printed as an integer.
Other than in the implementation of qemu_mem
This series does some cleanup of the qemu_oom_check() and
qemu_memalign() functions; I started looking at the first of these and
found myself wanting to tidy some stuff relating to the second in the
process. The TLDR is that this series removes qemu_oom_check() (which
was mostly being misused), uni
Instead of assuming that all CONFIG_BSD have valloc() and anything
else is memalign(), explicitly check for those functions in
meson.build and use the "is the function present" define. Tests for
specific functionality are better than which-OS checks; this also
lets us give a helpful error message
The qemu_try_memalign() functions for POSIX and Windows used to be
significantly different, but these days they are identical except for
the actual allocation function called, and the POSIX version already
has to have ifdeffery for different allocation functions.
Move to a single implementation in
Move the various memalign-related functions out of osdep.h and into
their own header, which we include only where they are used.
While we're doing this, add some brief documentation comments.
Signed-off-by: Peter Maydell
---
include/qemu/memalign.h| 61 ++
We implement qemu_memalign() in both oslib-posix.c and oslib-win32.c,
but the two versions are essentially the same: they call
qemu_try_memalign(), and abort() after printing an error message if
it fails. The only difference is that the win32 version prints the
GetLastError() value whereas the POS
Currently if qemu_try_memalign() is asked to allocate 0 bytes, we assert.
Instead return NULL; this is in line with the posix_memalign() API,
and is valid to pass to _aligned_free() (which will do nothing).
This change is a preparation for sharing the qemu_try_memalign()
code between Windows and P
Currently we incorrectly think that posix_memalign() exists on
Windows. This is because of a combination of:
* the msys2/mingw toolchain/libc claim to have a
__builtin_posix_memalign when there isn't a builtin of that name
* meson will assume that if you have a __builtin_foo that
counts f
qemu_vfree() is the companion free function to qemu_memalign(); put
it in memalign.c so the allocation and free functions are together.
Signed-off-by: Peter Maydell
---
util/memalign.c| 11 +++
util/oslib-posix.c | 6 --
util/oslib-win32.c | 6 --
3 files changed, 11 insert
On Sat, 26 Feb 2022 at 18:07, Peter Maydell wrote:
Forgot to cc Gerd on this one as USB maintainer. Sorry..
> qemu_oom_check() is a function which essentially says "if you pass me
> a NULL pointer then print a message then abort()". On POSIX systems
> the message includes strerror(errno); on Wi
On 2/26/22 08:07, Peter Maydell wrote:
qemu_oom_check() is a function which essentially says "if you pass me
a NULL pointer then print a message then abort()". On POSIX systems
the message includes strerror(errno); on Windows it includes the
GetLastError() error value printed as an integer.
Oth
On 2/26/22 08:07, Peter Maydell wrote:
The qemu_oom_check() function, which we define in both oslib-posix.c
and oslib-win32.c, is now used only locally in that file; make it
static.
Signed-off-by: Peter Maydell
---
include/qemu-common.h | 2 --
util/oslib-posix.c| 2 +-
util/oslib-win32.
On 2/26/22 08:07, Peter Maydell wrote:
We implement qemu_memalign() in both oslib-posix.c and oslib-win32.c,
but the two versions are essentially the same: they call
qemu_try_memalign(), and abort() after printing an error message if
it fails. The only difference is that the win32 version prints
On 2/26/22 08:07, Peter Maydell wrote:
Currently if qemu_try_memalign() is asked to allocate 0 bytes, we assert.
Instead return NULL; this is in line with the posix_memalign() API,
and is valid to pass to _aligned_free() (which will do nothing).
This change is a preparation for sharing the qemu_
On 2/26/22 08:07, Peter Maydell wrote:
Currently we incorrectly think that posix_memalign() exists on
Windows. This is because of a combination of:
* the msys2/mingw toolchain/libc claim to have a
__builtin_posix_memalign when there isn't a builtin of that name
* meson will assume that
On 2/26/22 08:07, Peter Maydell wrote:
Currently if qemu_try_memalign() is asked to allocate 0 bytes, we assert.
Instead return NULL; this is in line with the posix_memalign() API,
and is valid to pass to _aligned_free() (which will do nothing).
This change is a preparation for sharing the qemu_
On 2/26/22 08:07, Peter Maydell wrote:
The qemu_try_memalign() functions for POSIX and Windows used to be
significantly different, but these days they are identical except for
the actual allocation function called, and the POSIX version already
has to have ifdeffery for different allocation funct
On 2/26/22 08:07, Peter Maydell wrote:
Instead of assuming that all CONFIG_BSD have valloc() and anything
else is memalign(), explicitly check for those functions in
meson.build and use the "is the function present" define. Tests for
specific functionality are better than which-OS checks; this a
On 2/26/22 08:07, Peter Maydell wrote:
qemu_vfree() is the companion free function to qemu_memalign(); put
it in memalign.c so the allocation and free functions are together.
Signed-off-by: Peter Maydell
---
util/memalign.c| 11 +++
util/oslib-posix.c | 6 --
util/oslib-win3
On 2/26/22 08:07, Peter Maydell wrote:
Move the various memalign-related functions out of osdep.h and into
their own header, which we include only where they are used.
While we're doing this, add some brief documentation comments.
Signed-off-by: Peter Maydell
---
Reviewed-by: Richard Henderson
21 matches
Mail list logo