@@ -22,7 +22,8 @@
#include <string.h>
#include <stdlib.h>
-
+#include <sys/types.h>
+#include <unistd.h>
#if ODP_CONFIG_POOLS > ODP_BUFFER_MAX_POOLS
#error ODP_CONFIG_POOLS > ODP_BUFFER_MAX_POOLS
@@ -259,6 +260,8 @@ odp_pool_t _pool_create(const char *name,
/* Find an unused buffer pool slot and iniitalize it as requested */
for (i = 0; i < ODP_CONFIG_POOLS; i++) {
+ char *pool_shm_name;
+
pool = get_pool_entry(i);
POOL_LOCK(&pool->s.lock);
@@ -303,9 +306,13 @@ odp_pool_t _pool_create(const char *name,
mdata_size +
udata_size);
- shm = odp_shm_reserve(pool->s.name,
+ pool_shm_name = calloc(1, ODP_SHM_NAME_LEN);
+ sprintf(pool_shm_name, "%s_%d", name, getpid());
+
+ shm = odp_shm_reserve(pool_shm_name,
pool->s.pool_size,
ODP_PAGE_SIZE, shmflags);
+ free(pool_shm_name);
if (shm == ODP_SHM_INVALID) {
POOL_UNLOCK(&pool->s.lock);
return ODP_POOL_INVALID;
@@ -237,6 +237,8 @@ static void _ipc_export_pool(struct pktio_info *pinfo,
odp_pool_t pool)
{
pool_entry_t *pool_entry;
+ odp_shm_t pool_shm;
+ odp_shm_info_t shm_info;
pool_entry = odp_pool_to_entry(pool);
if (pool_entry->s.blk_size != pinfo->master.shm_pkt_size)
@@ -244,8 +246,12 @@ static void _ipc_export_pool(struct pktio_info *pinfo,
if (pool_entry->s.buf_num != (unsigned)pinfo->master.shm_pool_bufs_num)
ODP_ABORT("pktio for same name should have the same pool size\n");
+ pool_shm = pool_entry->s.pool_shm;
+ if (0 != odp_shm_info(pool_shm, &shm_info))
+ ODP_ABORT("unable to get shm info\n");
+
snprintf(pinfo->slave.pool_name, ODP_POOL_NAME_LEN, "%s",
- pool_entry->s.name);
+ shm_info.name);
pinfo->slave.mdata_offset = pool_entry->s.pool_mdata_addr -
pool_entry->s.pool_base_addr;
}
@@ -24,8 +24,8 @@ run()
#if test was interrupted with CTRL+c than files
#might remain in shm. Needed cleanely delete them.
rm -rf /dev/shm/ipc_pktio_* 2>&1 > /dev/null
- rm -rf /dev/shm/packet_pool1 2>&1 > /dev/null
- rm -rf /dev/shm/packet_pool2 2>&1 > /dev/null
+ rm -rf /dev/shm/packet_pool1* 2>&1 > /dev/null
+ rm -rf /dev/shm/packet_pool2* 2>&1 > /dev/null
echo "==== run pktio_ipc1 then pktio_ipc2 ===="
pktio_ipc1${EXEEXT} -t 30 &
@@ -40,8 +40,8 @@ run()
kill ${IPC_PID} 2>&1 > /dev/null
if [ $? -eq 0 ]; then
rm -rf /dev/shm/ipc_pktio_* 2>&1 > /dev/null
- rm -rf /dev/shm/packet_pool1 2>&1 > /dev/null
- rm -rf /dev/shm/packet_pool2 2>&1 > /dev/null
+ rm -rf /dev/shm/packet_pool1* 2>&1 > /dev/null
+ rm -rf /dev/shm/packet_pool2* 2>&1 > /dev/null
fi
if [ $ret -ne 0 ]; then