All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3] exec: posix_madvise usage on SunOS.
@ 2020-07-18 13:20 David CARLIER
  2020-07-18 14:15 ` Peter Maydell
  0 siblings, 1 reply; 7+ messages in thread
From: David CARLIER @ 2020-07-18 13:20 UTC (permalink / raw)
  To: qemu-devel, QEMU Trivial

From a9e3cced279ae55a59847ba232f7828bc2479367 Mon Sep 17 00:00:00 2001
From: David Carlier <devnexen@gmail.com>
Date: Sat, 18 Jul 2020 13:29:44 +0100
Subject: [PATCH 2/3] exec: posix_madvise usage on SunOS.

with _XOPEN_SOURCE set, the older mman.h API based on caddr_t handling
is not accessible thus using posix_madvise here.

Signed-off-by: David Carlier <devnexen@gmail.com>
---
 exec.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/exec.c b/exec.c
index 6f381f98e2..0466a75b89 100644
--- a/exec.c
+++ b/exec.c
@@ -3964,7 +3964,15 @@ int ram_block_discard_range(RAMBlock *rb,
uint64_t start, size_t length)
              * fallocate'd away).
              */
 #if defined(CONFIG_MADVISE)
+#if !defined(CONFIG_SOLARIS)
             ret =  madvise(host_startaddr, length, MADV_DONTNEED);
+#else
+        /*
+         * mmap and its caddr_t based api is not accessible
+         * with _XOPEN_SOURCE set on illumos
+         */
+            ret =  posix_madvise(host_startaddr, length, POSIX_MADV_DONTNEED);
+#endif
             if (ret) {
                 ret = -errno;
                 error_report("ram_block_discard_range: Failed to
discard range "
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-07-21  9:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-18 13:20 [PATCH 2/3] exec: posix_madvise usage on SunOS David CARLIER
2020-07-18 14:15 ` Peter Maydell
2020-07-18 15:23   ` David CARLIER
2020-07-20 19:13   ` Dr. David Alan Gilbert
2020-07-21  8:22     ` David Hildenbrand
2020-07-21  9:31       ` Peter Maydell
2020-07-21  9:48         ` David Hildenbrand

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.