From 9bc5a7193fb422ee53187601eba577ee5d195522 Mon Sep 17 00:00:00 2001 From: Andreas Gustafsson Date: Thu, 4 Jan 2018 19:39:36 +0200 Subject: oslib-posix: check for posix_memalign in configure script Check for the presence of posix_memalign() in the configure script, not using "defined(_POSIX_C_SOURCE) && !defined(__sun__)". This lets qemu use posix_memalign() on NetBSD versions that have it, instead of falling back to valloc() which is wasteful when the required alignment is smaller than a page. Signed-off-by: Andreas Gustafsson Signed-off-by: Michael Tokarev Reviewed-by: Kamil Rytarowski Reviewed-by: Peter Maydell --- util/oslib-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util') diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 77369c9..4655bc1 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -105,7 +105,7 @@ void *qemu_try_memalign(size_t alignment, size_t size) alignment = sizeof(void*); } -#if defined(_POSIX_C_SOURCE) && !defined(__sun__) +#if defined(CONFIG_POSIX_MEMALIGN) int ret; ret = posix_memalign(&ptr, alignment, size); if (ret != 0) { -- cgit v1.1