reply to a message from another process
#include <sys/kernel.h> #include <sys/sendmx.h> int Replymx( pid_t pid, unsigned parts, struct _mxfer_entry *msgmx );
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.
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. |
See Sendmx().
QNX
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | Yes, but modifies errno |
Thread | Yes |
Replymx() is a macro.
Creceive(), Creceivemx(), errno, Readmsg(), Readmsgmx(), Receive(), Receivemx(), Reply(), Send(), Sendfd(), Sendfdmx(), Sendmx(), Writemsg(), Writemsgmx(), Trigger()