ivshmem-server: Clean up shmem on shutdown
PATCH v2 1/1 ivshmem-server: Clean up shmem on shutdown
From: Jan Kiszka <[email protected]>
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.
---
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(+)
contrib/ivshmem-server/ivshmem-server.c +6 -0
@@ -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
Quoted 41 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
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 <[email protected]>---
Changes in v2:
- respectuse_shm_open
- also clean up inivshmem_server_starterror pathcontrib/ivshmem-server/ivshmem-server.c | 6 ++++++ 1 file changed, 6 insertions(+)contrib/ivshmem-server/ivshmem-server.c +6
-1@@ -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 ; --
Quoted 3 lines
2.16.4
Quoted 34 lines · Claudio Fontana
Quoted 33 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
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 <[email protected]>---
Changes in v2:
- respectuse_shm_open
- also clean up inivshmem_server_starterror pathcontrib/ivshmem-server/ivshmem-server.c | 6 ++++++ 1 file changed, 6 insertions(+)contrib/ivshmem-server/ivshmem-server.c +3
-0@@ -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) }
Quoted 16 lines
Quoted 11 lines
contrib/ivshmem-server/ivshmem-server.c +3
-1unlink (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
Reviewed-by Claudio Fontana <[email protected]>
Markus, would you take this?
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux
Quoted 49 lines · Jan Kiszka
Quoted 34 lines · Claudio Fontana
Quoted 33 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
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 <[email protected]>---
Changes in v2:
- respectuse_shm_open
- also clean up inivshmem_server_starterror pathcontrib/ivshmem-server/ivshmem-server.c | 6 ++++++ 1 file changed, 6 insertions(+)contrib/ivshmem-server/ivshmem-server.c +3
-0@@ -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) }Quoted 13 lines
Quoted 11 lines
contrib/ivshmem-server/ivshmem-server.c +3
-1unlink (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
Reviewed-by Claudio Fontana <[email protected]>
Quoted 1 line
Markus, would you take this?
ivshmem has no maintainer. I you need me to serve as a pull request monkey of last resort, I can do that. However, for this one, qemu-trivial (cc'ed) should do.
Laurent Vivier
AppliedLe 08/11/2019 à 16:14, Markus Armbruster a écrit :
Quoted 51 lines
Quoted 49 lines · Jan Kiszka
Quoted 47 lines · Claudio Fontana
Quoted 41 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
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 <[email protected]>---
Changes in v2:
- respectuse_shm_open
- also clean up inivshmem_server_starterror pathcontrib/ivshmem-server/ivshmem-server.c | 6 ++++++ 1 file changed, 6 insertions(+)contrib/ivshmem-server/ivshmem-server.c +6
-1@@ -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 ; --Quoted 3 lines
2.16.4
Reviewed-by Claudio Fontana <[email protected]>
Quoted 7 lines
Quoted 1 line
Markus, would you take this?
ivshmem has no maintainer. I you need me to serve as a pull request monkey of last resort, I can do that. However, for this one, qemu-trivial (cc'ed) should do.
Applied to my trivial-patches branch.
Thanks,
Laurent