From: Jan Kiszka <jan.kiszka@web.de>
To: qemu-devel <qemu-devel@nongnu.org>
Cc: Claudio Fontana <cfontana@suse.de>
Subject: [Qemu-devel] [PATCH v2] ivshmem-server: Clean up shmem on shutdown
Date: Mon, 5 Aug 2019 07:54:52 +0200 [thread overview]
Message-ID: <d938a62c-7538-9d2b-cc0a-13b240ab9141@web.de> (raw)
From: Jan Kiszka <jan.kiszka@siemens.com>
So far, the server leaves the posix shared memory object behind when
terminating, requiring the user to explicitly remove it in order to
start a new instance.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
Changes in v2:
- respect use_shm_open
- also clean up in ivshmem_server_start error path
contrib/ivshmem-server/ivshmem-server.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/contrib/ivshmem-server/ivshmem-server.c b/contrib/ivshmem-server/ivshmem-server.c
index 77f97b209c..88daee812d 100644
--- a/contrib/ivshmem-server/ivshmem-server.c
+++ b/contrib/ivshmem-server/ivshmem-server.c
@@ -353,6 +353,9 @@ ivshmem_server_start(IvshmemServer *server)
err_close_sock:
close(sock_fd);
err_close_shm:
+ if (server->use_shm_open) {
+ shm_unlink(server->shm_path);
+ }
close(shm_fd);
return -1;
}
@@ -370,6 +373,9 @@ ivshmem_server_close(IvshmemServer *server)
}
unlink(server->unix_sock_path);
+ if (server->use_shm_open) {
+ shm_unlink(server->shm_path);
+ }
close(server->sock_fd);
close(server->shm_fd);
server->sock_fd = -1;
--
2.16.4
next reply other threads:[~2019-08-05 5:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-05 5:54 Jan Kiszka [this message]
2019-08-06 13:01 ` [Qemu-devel] [PATCH v2] ivshmem-server: Clean up shmem on shutdown Claudio Fontana
2019-11-08 9:08 ` Jan Kiszka
2019-11-08 15:14 ` Markus Armbruster
2019-11-12 9:36 ` Laurent Vivier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d938a62c-7538-9d2b-cc0a-13b240ab9141@web.de \
--to=jan.kiszka@web.de \
--cc=cfontana@suse.de \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).