[Previous]
[Contents]
[Next]

Replymx()

reply to a message from another process

Synopsis:

#include <sys/kernel.h>
#include <sys/sendmx.h>
int Replymx( pid_t pid,
             unsigned parts,
             struct _mxfer_entry *msgmx );

Description:

The kernel function Replymx() replies with a message taken from the array of message buffers pointed to by msgmx to the process identified by pid. The number of elements in this array is given by nparts, which must not exceed _QNX_MXTAB_LEN (defined in <limits.h>). The size of the message is the sum of the sizes of each buffer. The process pid must have sent a message that was received and not yet replied to. It must be in the REPLY BLOCKED state.

The number of bytes transferred is the minimum of that specified by both the replier and the sender. The reply data isn't allowed to overflow the reply buffer area provided by the sender.

The data transfer occurs immediately, and the replying task doesn't block. Reply() changes the state of the sending task from REPLY BLOCKED to READY. You should reply to every message that you receive, but you don't have to do so immediately.

It's quite common to reply with 2-part messages consisting of a fixed header and a buffer of data. The Replymx() will gather the data from the buffer list into a logically contiguous message and transfer it to the sender's reply buffer(s). The sender need not specify the same number or size of buffers. The data is laid down, filling each buffer as required. The file system, for example, builds a reply list pointing into its cache in order to reply with what looks like one contiguous piece of data.


Note: Avoid stuffing each _mxfer_entry directly. Instead use the _setmx() macro to stuff each entry. This will make your code portable across 16- and 32-bit platforms.

Returns:

0
Success
-1
An error occurred. errno is set to indicate the error.

Errors:

EAGAIN
No more Process Manager to Network Manager queue packets available.
EDSTFAULT
Destination would fault on a message pass.
EFAULT
In order to complete the message exchange, the current process would have incurred a segment violation. You need to make your buffer(s) larger, or limit the number of bytes allowed in the transfer.
EINTR
Call interrupted by a signal.
EINVAL
The virtual circuit buffer can't be grown due to an invalid message length.
ENOMEM
The virtual circuit buffer can't be grown because no memory is available.
ESRCH
The process pid doesn't exist.

Examples:

See Sendmx().

Classification:

QNX

Safety:
Interrupt handler No
Signal handler Yes, but modifies errno
Thread Yes

Caveats:

Replymx() is a macro.

See also:

Creceive(), Creceivemx(), errno, Readmsg(), Readmsgmx(), Receive(), Receivemx(), Reply(), Send(), Sendfd(), Sendfdmx(), Sendmx(), Writemsg(), Writemsgmx(), Trigger()


[Previous]
[Contents]
[Next]