![]() |
![]() |
![]() |
Read data from a message
#include <sys/neutrino.h> int MsgRead( int rcvid, void* msg, int bytes, int offset ); int MsgRead_r( int rcvid, void* msg, int bytes, int offset );
libc
The MsgRead() and MsgRead_r() functions are identical except in the way they indicate errors. See the Returns section for details.
These kernel calls read data from a message sent by a thread identified by rcvid. The rcvid is returned from MsgReceive*() when you receive the message. The thread being read from must not have been replied to and will be in the REPLY-blocked state. Any thread in the receiving process is free to read the message.
The data is placed in the msg buffer.
The offset allows data to be read from the thread's send message starting at any point. The data transfer occurs immediately and the thread doesn't block. The state of the sending thread doesn't change.
An attempt to read past the end of the thread's message results in fewer bytes returned than requested.
This function is used in one of three situations:
When you are through using MsgRead() you must use MsgReply*() to ready the REPLY-blocked process and complete the message exchange.
None. In the network case, lower priority threads may run.
The MsgRead() function has increased latency when it's used to communicate across a network -- a message pass is involved from the server to the network manager (at least). Depending on the size of the data transfer, the server's npm-qnet and the client's npm-qnet may need to communicate over the link to read more data bytes from the client.
The only difference between the MsgRead() and MsgRead_r() functions is the way they indicate errors:
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
MsgReadv(), MsgReceive(), MsgReceivev(), MsgReply(), MsgReplyv(), MsgWrite(), MsgWritev()
![]() |
![]() |
![]() |