@@ -14,6 +14,7 @@
#ifndef ODP_API_SHARED_MEMORY_H_
#define ODP_API_SHARED_MEMORY_H_
#include <odp/visibility_begin.h>
+#include <odp/api/init.h>
#ifdef __cplusplus
extern "C" {
@@ -62,6 +63,13 @@ extern "C" {
* be swapped out (nor physically moved in physical address space).
*/
#define ODP_SHM_LOCK 0x8
+/**
+ * Export memory
+ *
+ * When set, the memory block becomes visible to other ODP instances
+ * through odp_shm_reserve_exported().
+ */
+#define ODP_SHM_EXPORT 0x10
/**
* Shared memory block info
@@ -148,6 +156,24 @@ int odp_shm_free(odp_shm_t shm);
*/
odp_shm_t odp_shm_lookup(const char *name);
+/**
+ * Get and reserve a block of shared memory, exported by another ODP instance
+ *
+ * @param remote_name Name of the block, in the remote ODP instance
+ * @param odp_inst Remote ODP instance, as returned by odp_init_global()
+ * @param local_name Name given to the block, in the local ODP instance
+ * (or NULL, if the application doesn't care)
+ * @param align Block alignment in bytes
+ * @param flags Shared memory parameter flags (ODP_SHM_*).
+ * Default value is 0.
+ *
+ * @return A new handle to the block if it is found (must be freed when done).
+ * @retval ODP_SHM_INVALID on failure
+ */
+odp_shm_t odp_shm_reserve_exported(const char *remote_name,
+ odp_instance_t odp_inst,
+ const char *local_name,
+ uint64_t align, uint32_t flags);
/**
* Shared memory block address
The flag ODP_SHM_EXPORT is added: when passed at odp_shm_reserve() time the memory block becomes visible to other ODP instances. The function odp_shm_reserve_exported() is added: this function enables to reserve block of memories exported by other ODP instances (using the ODP_SHM_EXPORT flag). Signed-off-by: Christophe Milard <christophe.milard@linaro.org> --- include/odp/api/spec/shared_memory.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) -- 2.7.4