memobj_share()
Allocate a new handle that references an existing memory object
Synopsis:
#include <memobj/share.h>
errno_t memobj_share(struct memobj **obj_out, const struct memobj *orig_obj, const struct memobj_share_attr *attr)
Arguments:
- obj_out
- A pointer to a location where this function, on success, stores a handle to the new memory object.
- orig_obj
- The object whose memory you want to share.
- attr
-
Used to specified a new access mode for the shared object. If
NULL, the access mode of the new object matches the original.
Library:
libmemobjDescription:
The memobj_share() function allocates a new handle that references an existing memory object. A new handle references the same underlying memory as the original, but tracks locks and mappings separately. A new handle opens a new file descriptor of the original memory object; therefore, each memory object has its own file descriptor. The new file descriptor is opened from a side channel pool. This descriptor is closed as part of a memobj_close() call.
Returns:
- EOK
-
Success;
*obj_outwas filled.
- ENOMEM
- There isn't enough memory.
- EMFILE
- There are already OPEN_MAX file descriptors in use.
- ENFILE
- Too many files are open in the system.
Page updated:
