aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYi He <yi.he@linaro.org>2016-06-02 11:04:14 +0000
committerMaxim Uvarov <maxim.uvarov@linaro.org>2016-06-02 15:58:56 +0300
commit9d2ee6f85a8ed2502eb1238c39ccb5a6f44d1d87 (patch)
tree91edf14f2d9a801003d6e3f452e399d225a00131
parent3c32dd2267d768e0ddc51f3d86979854946078fc (diff)
linux-generic: shared memory: fix the name composition in odp_shm_free
Fix the name composition in odp_shm_free() as the same algorithm in odp_shm_reserve(), use IPC namespace if provided or process ID in default. Signed-off-by: Yi He <yi.he@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
-rw-r--r--platform/linux-generic/odp_shared_memory.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/platform/linux-generic/odp_shared_memory.c b/platform/linux-generic/odp_shared_memory.c
index 568711a16..f432cf92b 100644
--- a/platform/linux-generic/odp_shared_memory.c
+++ b/platform/linux-generic/odp_shared_memory.c
@@ -179,9 +179,15 @@ int odp_shm_free(odp_shm_t shm)
}
if (block->flags & ODP_SHM_PROC || block->flags & _ODP_SHM_PROC_NOCREAT) {
+ int shm_ns_id;
+
+ if (odp_global_data.ipc_ns)
+ shm_ns_id = odp_global_data.ipc_ns;
+ else
+ shm_ns_id = odp_global_data.main_pid;
+
snprintf(shm_devname, SHM_DEVNAME_MAXLEN,
- SHM_DEVNAME_FORMAT, odp_global_data.main_pid,
- block->name);
+ SHM_DEVNAME_FORMAT, shm_ns_id, block->name);
ret = shm_unlink(shm_devname);
if (0 != ret) {
ODP_DBG("odp_shm_free: shm_unlink failed\n");