[Previous] [Contents] [Next]

MsgInfo(), MsgInfo_r()

Get additional information about a message

Synopsis:

#include <sys/neutrino.h>

int MsgInfo( int rcvid,
             struct _msg_info* info );

int MsgInfo_r( int rcvid,
               struct _msg_info* info );

Library:

libc

Description:

The MsgInfo() and MsgInfo_r() functions are identical except in the way they indicate errors. See the Returns section for details.

These kernel calls store additional information on a received message into info. The rcvid argument is the return value from MsgReceive*().

The parameters returned in the info have at least the following members:

Member Description
uint32_t nd The node descriptor of the client machine as viewed by the server.
uint32_t srcnd The node descriptor of the server as viewed by the client.
pid_t pid The process ID of the sending thread.
int32_t tid The thread ID of the sending thread.
int32_t chid The channel ID the message was received on.
int32_t scoid The server connection ID.
int32_t coid The client connection ID.
int32_t msglen The number of bytes received.
int32_t srcmsglen The length of the source message, in bytes, as sent by MsgSend*(). This may be greater than the value in msglen. This member is only valid if _NTO_CHF_SENDER_LEN was set in the flags argument to ChannelCreate() for the channel that transmitted the message.
int16_t priority The priority of the sending thread.
int16_t flags The client has an unblock pending _NTO_MI_UNBLOCK_REQ (i.e. a timeout on the send occurred or a signal was delivered and _NTO_CHF_UNBLOCK is set on the channel).

WARNING: The info->msglen and info->srcmsglen members are valid only until the next MsgRead*() / MsgWrite*() call!

If msglen is less than srcmsglen, and also less than the receive buffer size, it's a network transaction that requires more reading of data with MsgRead*().

Blocking states

This call doesn't block.

Node descriptor

The node descriptor datatype is a magic cookie.

To: Use this function:
Compare two nd objects ND_NODE_CMP()
Convert a nd to text netmgr_ndtostr()
Convert text to a nd netmgr_strtond()

Returns:

The only difference between these functions is the way they indicate errors:

MsgInfo()
If an error occurs, -1 is returned and errno is set. Any other value returned indicates success.
MsgInfo_r()
EOK is returned on success. This function does NOT set errno. If an error occurs, any value in the Errors section may be returned.

Errors:

EFAULT
A fault occurred when the kernel tried to access the buffers provided.
ESRCH
The thread indicated by rcvid doesn't exist.

Classification:

QNX 6

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

ChannelCreate(), MsgRead(), MsgReadv(), MsgReceive(), MsgReceivev(), MsgSend(), MsgSendv(), ND_NODE_CMP(), netmgr_ndtostr(), netmgr_remote_nd(), netmgr_strtond()


[Previous] [Contents] [Next]