#include <mem/chMem.h>int rgnDup(KnCap *tgtactorcap, KnCap *srcactorcap, VmFlags flags);
The function or functions documented here may not be used safely in all application contexts with all APIs provided in the ChorusOS 5.0 product.
See API(5FEA) for details.
The rgnDup() function duplicates regions from the address space specified by srcactorcap into the actor address space specified by tgtactorcap. If srcactorcap or tgtactorcap is K_MYACTOR, the address space of the current actor is used as the source or the destination, respectively.
For each region from the source actor rgnDup() duplicates the region in the target actor address space with the same address, size and attributes (options).
The duplicate region can either share the data with the source region (map to the same segment of volatile memory as the source), or take a private volatile copy. The data is shared if the flags argument is K_INHERITSHARE or if flags is zero and the source region has the K_INHERITSHARE attribute. The data is copied if the flags argument is K_INHERITCOPY or if flags is zero and the source region has the K_INHERITCOPY attribute.
The region is not duplicated if the flag argument is zero and the region has neither the K_INHERITSHARE nor the K_INHERITCOPY attribute.
Before the operation, the target actor address space must be empty.
If successful, K_OK is returned, otherwise a negative error code is returned.
Some of the arguments provided are outside the caller's address space.
An inconsistent actor capability was provided.
tgtactorcap or srcactorcap does not specify a reachable actor.
The target actor address space is not empty.
The system is out of resources.
The segment mapper does not respect the microkernel/mapper protocol.
The target actor, the source actor and the current actor must be located on the same site.
See attributes(5) for descriptions of the following attributes:
|ATTRIBUTE TYPE||ATTRIBUTE VALUE|