[API-NEXT,PATCHv4,05/16] api: shm: add flag to guarantee address unicity on all ODP threads

Message ID 1477301053-35938-6-git-send-email-christophe.milard@linaro.org
State New
Headers show

Commit Message

Christophe Milard Oct. 24, 2016, 9:24 a.m.
The ODP_SHM_SINGLE_VA flag is created: when set (at odp_shm_reserve()),
this flag guarantees that all ODP threads sharing this memory
block will see the block at the same address (regadless of ODP
thread type -pthread vs process- or fork time)

Signed-off-by: Christophe Milard <christophe.milard@linaro.org>

---
 include/odp/api/spec/shared_memory.h | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

-- 
2.7.4

Patch

diff --git a/include/odp/api/spec/shared_memory.h b/include/odp/api/spec/shared_memory.h
index 8c76807..bd4731a 100644
--- a/include/odp/api/spec/shared_memory.h
+++ b/include/odp/api/spec/shared_memory.h
@@ -43,12 +43,18 @@  extern "C" {
 #define ODP_SHM_NAME_LEN 32
 
 /*
- * Shared memory flags
+ * Shared memory flags:
  */
-
-/* Share level */
-#define ODP_SHM_SW_ONLY 0x1 /**< Application SW only, no HW access */
-#define ODP_SHM_PROC    0x2 /**< Share with external processes */
+#define ODP_SHM_SW_ONLY		0x1 /**< Application SW only, no HW access   */
+#define ODP_SHM_PROC		0x2 /**< Share with external processes       */
+/**
+ * Single virtual address
+ *
+ * When set, this flag guarantees that all ODP threads sharing this
+ * memory block will see the block at the same address - regardless
+ * of ODP thread type (e.g. pthread vs. process (or fork process time)).
+ */
+#define ODP_SHM_SINGLE_VA	0x4
 
 /**
  * Shared memory block info