On 11/7/2024 11:19 AM, David Hildenbrand wrote:
On 07.11.24 15:04, Steven Sistare wrote:
On 11/7/2024 8:05 AM, David Hildenbrand wrote:
[...]
Do you plan to submit the part of your "tmp" patch that refactors
shm_backend_memory_alloc and defines qemu_shm_alloc?  If you want,
I could include it in my series, with your Signed-off-by.

My patch went a bit too far I think. And would not work on win32 :)

We should probably start with this:

From 124920aeda2756faa104bfa6e934c7c20b1fbbe9 Mon Sep 17 00:00:00 2001
From: David Hildenbrand <da...@redhat.com>
Date: Mon, 4 Nov 2024 11:29:22 +0100
Subject: [PATCH] backends/hostmem-shm: factor out allocation of "anonymous
 shared memory with an fd"

Let's factor it out so we can reuse it.

Signed-off-by: David Hildenbrand <da...@redhat.com>
---
 backends/hostmem-shm.c | 45 ++++-------------------------------
 include/qemu/osdep.h   |  1 +
 system/physmem.c       |  2 +-
 util/oslib-posix.c     | 53 ++++++++++++++++++++++++++++++++++++++++++
 util/oslib-win32.c     |  6 +++++
5 files changed, 65 insertions(+), 42 deletions(-)
[...]

Thanks, I see what you fixed.

FYI I deleted this remnant from "tmp":

> @@ -2089,7 +2089,7 @@ RAMBlock *qemu_ram_alloc_internal(ram_addr_t size, 
ram_addr_t max_size,
>       new_block->page_size = qemu_real_host_page_size();
>       new_block->host = host;
>       new_block->flags = ram_flags;
> -    ram_block_add(new_block, &local_err);
> +

and I added this so all programs that link with libqemuutil also link with
rt, which defines shm_open:

diff --git a/meson.build b/meson.build
index e324c49..aa54535 100644
--- a/meson.build
+++ b/meson.build
@@ -3604,9 +3604,13 @@ libqemuutil = static_library('qemuutil',
                              build_by_default: false,
                              sources: util_ss.sources() + stub_ss.sources() + 
genh,
                              dependencies: [util_ss.dependencies(), libm, 
threads, glib, socket, malloc])
+qemuutil_deps = [event_loop_base]
+if host_os != 'windows'
+  qemuutil_deps += [rt]
+endif
 qemuutil = declare_dependency(link_with: libqemuutil,
                               sources: genh + version_res,
-                              dependencies: [event_loop_base])
+                              dependencies: qemuutil_deps)

- Steve


Reply via email to