aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorAndreas Gustafsson <gson@gson.org>2018-01-04 19:39:36 +0200
committerMichael Tokarev <mjt@tls.msk.ru>2018-02-10 10:21:50 +0300
commit9bc5a7193fb422ee53187601eba577ee5d195522 (patch)
tree0511b1f31ac63a664f67c850aba70c8f031351f8 /util
parenta348f64d4652d68212886019ca74825aa1667969 (diff)
downloadqemu-9bc5a7193fb422ee53187601eba577ee5d195522.zip
qemu-9bc5a7193fb422ee53187601eba577ee5d195522.tar.gz
qemu-9bc5a7193fb422ee53187601eba577ee5d195522.tar.bz2
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 <gson@gson.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Kamil Rytarowski <n54@gmx.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'util')
-rw-r--r--util/oslib-posix.c2
1 files changed, 1 insertions, 1 deletions
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) {