Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Indicating truncation to the calling process

0 views
Skip to first unread message

karthikbalaguru

unread,
Jan 31, 2010, 12:28:21 PM1/31/10
to
Hi,

I understand that the msgrcv()
function would read a message from
the queue associated with the
message queue id and place it
in the buffer(userdefined).

Further, it has an argument of type
size_t that indicates the maximum
size(in bytes) of the message that can
be received or truncated incase of larger
message.

Incase of large messages, the
truncated part of the message shall
be lost . But is there a mechanism
to indicate the calling process about
truncation ? Or is there an alternate
API that has an feature of indicating
the calling thread of the truncation ?
Any ideas ?

Thx in advans,
Karthik Balaguru

David Schwartz

unread,
Jan 31, 2010, 8:36:06 PM1/31/10
to
On Jan 31, 9:28 am, karthikbalaguru <karthikbalagur...@gmail.com>
wrote:

Just pass one extra byte of buffer space.

Suppose you were going to pass, say, 1,024 bytes to 'msgrcv'. Instead,
pass 1,025. If you get 1,025 bytes, then your 1,024 byte received
would have truncated.

DS

karthikbalaguru

unread,
Jan 31, 2010, 10:15:59 PM1/31/10
to

Hey David, Thx for your reply.
Okay, if we pass even a single
extra byte, it gets truncated.

The name 'MSG_NOERROR'
to truncate the message text if longer
than msgsz bytes is misleading :-(

Considering MSG_NOERROR
is specified, how will the calling
process know that the truncation
has happened as only few of the
messages are larger in my scenario ?

David Schwartz

unread,
Feb 1, 2010, 6:40:16 PM2/1/10
to
On Jan 31, 7:15 pm, karthikbalaguru <karthikbalagur...@gmail.com>
wrote:

> Considering MSG_NOERROR
> is specified, how will the calling
> process know that the truncation
> has happened as only few of the
> messages are larger in my scenario ?

Say you were going to call with a 1,024 byte buffer. Simply call with
a 1,025 byte buffer instead. If you receive 1,025 bytes, then the
message was truncated.

DS

karthikbalaguru

unread,
Feb 1, 2010, 8:43:33 PM2/1/10
to

:-)

Karthik Balaguru

karthikbalaguru

unread,
Feb 1, 2010, 9:08:24 PM2/1/10
to
On Feb 2, 6:43 am, karthikbalaguru <karthikbalagur...@gmail.com>
wrote:

I think, this support for indicating
to the calling process about the
truncation of particular messages
should be added in msgrcv() .

Karthik Balaguru

0 new messages