NAME | SYNOPSIS | FEATURES | API RESTRICTIONS | DESCRIPTION | RESTRICTIONS | RETURN VALUE | ERRORS | ATTRIBUTES | SEE ALSO
#include <mipc/chMipc.h>int msgAllocate(int spaceLid, unsigned int poolIndex, unsigned int msgSize, KnTimeVal *waitLimit, char **msgAddr);
MIPC
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.
msgAllocate attempts to allocate a message from the most appropriate message pool of the message space designated by spaceLid.
With MIPC_S, the only valid value for spaceLid is 0.
poolIndex is either the index of the message pool from which the message must be allocated or the specific K_ANY_MSGPOOL constant.
msgSize is the size of the application message.
waitLimit optionally specifies a timeout, and may also specify a non abortable wait.
msgAddr is the address of a pointer where to store the address of the allocated message.
msgAllocate considers the message pool which is designated by poolIndex, if it is not equal to K_ANY_MSGPOOL, or parses the list of message pools of the Message Space to find the pool which fits the requested message size. If the message pool is not empty, msgAllocate takes the first free message, computes its address within the addressing space of the caller, and stores it into the msgAddr pointer.
If the pool is empty, msgAllocate does not try to allocate a message from a pool of bigger messages, if any. If waitLimit is equal to K_NOBLOCK(0), msgAllocate immediately returns a K_ETIMEOUT error code. Otherwise, it blocks the invoking thread until a message of the pool is freed by msgFree(2K) or until the timeout, if any, expires.
Interrupt handlers must always invoke msgAllocate with a delay of 0.
Upon successful completion, msgAllocate returns zero. Otherwise, a negative error code is returned.
spaceLid is not valid, or poolIndex is not valid, or waitLimit is not a valid KnTimeVal.
msgSize is greater than the maximum message size.
The maximum waiting time specified in waitLimit expired.
msgAddr is not a valid address within the addressing space of the caller.
The invoking thread was aborted while waiting for a message.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
NAME | SYNOPSIS | FEATURES | API RESTRICTIONS | DESCRIPTION | RESTRICTIONS | RETURN VALUE | ERRORS | ATTRIBUTES | SEE ALSO