#include <ipc/chIpc.h>int portMigrate(int options, KnCap * srcactorcap, int portli, KnCap * dstactorcap, KnEvtNum * seqnum);
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 portMigrate utility forces the port whose local identifier is portli in the actor whose capability is given by srcactorcap to migrate to the actor whose capability is given by dstactorcap. After the call, the port is attached to this destination actor. The local identifier of the portis returned by portMigrate to the destination actor.
If srcactorcap and/or dstactorcap is K_MYACTOR, the current actor is used as the source and/or destination of the migration.
The options , which describe the way in which the migration is performed may take one of the following values:
The messages queued behind the port follow the port during the migration.
The queued messages are deleted (and ipcCall (2K) transactions are aborted) before the migration.
The seqnum out parameter is a pointer to a count of messages that have been received on the source port, plus one additional increment for the migrate itself. The port message count is reset to 0 on the destination port.
If the port was inserted into port groups (using grpPortInsert (2K)) before the migration, the port remains a member of the same groups after the migration.
Ports that had been enabled (using portEnable (2K)) before the migration are disabled after the migration.
When a port migrates, any thread waiting for a message on that port exits its waiting state amd returns the K_ENOPORT error code.
A port may not be migrated if a message handler (see svMsgHandler (2K)) is attached to it. If such an attempt is made, the K_EBUSYPORT error code is returned.
The portGetSeqNum function gets the count of messages that have been received on the port whose local identifier is portli in the actor whose capability is given by srcactorcap. This count is stored by the microkernel in the data pointed to by seqnum.
Upon successful completion, portMigrate returns the local identifier of the port in the destination actor. Otherwise, a negative error code is returned.
srcactorcap or dstactorcap is an inconsistent actor capability or portli is not a port of the source actor.
srcactorcap or dstactorcap does not specify a reachable actor.
Some of the data provided are outside the current actor's address space.
The system is out of resources.
Attempted to migrate a port to which a message handler is attached.
Messages that are sent using ipcSend are not reliably forwarded to the new location of the port.
See attributes(5) for descriptions of the following attributes:
|ATTRIBUTE TYPE||ATTRIBUTE VALUE|