From: David Miller <davem@davemloft.net>
To: dkabs@mobotix.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: Problem with unix sockets: SOCK_DGRAM ignores MSG_TRUNC
Date: Sun, 04 Feb 2007 16:52:35 -0800 (PST) [thread overview]
Message-ID: <20070204.165235.26305735.davem@davemloft.net> (raw)
In-Reply-To: <200701291259.50155.dkabs@mobotix.com>
From: Daniel Kabs <dkabs@mobotix.com>
Date: Mon, 29 Jan 2007 12:59:49 +0100
> I use unix domain datagram sockets for IPC, e.g. I receive messages by
> calling recv().
>
> "man 2 recv" tells me about the flags argument to a recv() call, namely:
>
> MSG_TRUNC
> Return the real length of the packet, even when it was longer
> than the passed buffer. Only valid for packet sockets.
>
> Thus I used recv() with flags MSG_TRUNC|MSG_PEEK in order to detect
> message truncation due to insufficient buffer size.
What part of "Only valid for packet sockets" from the manual page
escapes you? :-))
It's a feature which only was meant to be valid for AF_PACKET sockets.
What UDP is doing is different, it's returning the full packet length
when the packet is larger then the given buffer size, but it does this
irregardless of whether you set MSG_TRUNC in the recvmsg() passed-in
flags. UDP itself sets the MSG_TRUNC flag when it detects this
situation.
I checked the history and our AF_UNIX sockets have always behaved like
this.
next prev parent reply other threads:[~2007-02-05 0:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-29 11:59 Daniel Kabs
2007-02-05 0:52 ` David Miller [this message]
2007-02-06 12:55 ` Daniel Kabs
2007-02-06 20:11 ` David Schwartz
2007-02-07 8:58 ` Daniel Kabs
2007-02-07 9:31 ` Daniel Kabs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070204.165235.26305735.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=dkabs@mobotix.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome