read a message from another process
#include <sys/kernel.h> unsigned Readmsg( pid_t pid, unsigned offset, void *msg, unsigned nbytes );
The kernel function Readmsg() reads nbytes of data into a buffer pointed to by msg from the process identified by pid. The offset allows you to read data from the sender's send message starting at any point. The data transfer occurs immediately, and your task doesn't block. The state of the process pid isn't changed.
The process pid must have sent a message that was received and not yet replied to. It must be in the REPLY BLOCKED state.
If you attempt to read past the end of the sender's message, Readmsg() will return fewer bytes than was specified by nbytes.
Readmsg() is a simple cover function that builds a single part _mxfer_entry on the stack, and calls Readmsgmx(), which is the real kernel function. It's provided for convenience, since it's easier to use than Readmsgmx() for simple messages. Please read the documentation for Readmsgmx() for examples on when to use it.
The number of bytes read. On error, -1 is returned and errno is set.
See Sendmx().
QNX
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | Yes, but modifies errno |
Thread | Yes |
Readmsg() is a macro.
Creceive(), Creceivemx(), errno, Receive(), Receivemx(), Reply(), Replymx(), Readmsgmx(), Send(), Sendfd(), Sendfdmx(), Sendmx(), Writemsg(), Writemsgmx(), Trigger()