[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKgNAkhzbRNvDLsDxYEJnET=Xi1S0eoB1-ER5GeiHE9OLY5bPA@mail.gmail.com>
Date: Thu, 20 Dec 2012 17:50:46 +0100
From: "Michael Kerrisk (man-pages)" <mtk.manpages@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: David Miller <davem@...emloft.net>, piergiorgio.beruto@...il.com,
netdev@...r.kernel.org
Subject: Re: [PATCH net-next] af_unix: MSG_TRUNC support for dgram sockets
On Wed, Feb 22, 2012 at 10:24 AM, Eric Dumazet <eric.dumazet@...il.com> wrote:
> Piergiorgio Beruto expressed the need to fetch size of first datagram in
> queue for AF_UNIX sockets and suggested a patch against SIOCINQ ioctl.
>
> I suggested instead to implement MSG_TRUNC support as a recv() input
> flag, as already done for RAW, UDP & NETLINK sockets.
>
> len = recv(fd, &byte, 1, MSG_PEEK | MSG_TRUNC);
>
> MSG_TRUNC asks recv() to return the real length of the packet, even when
> is was longer than the passed buffer.
>
> There is risk that a userland application used MSG_TRUNC by accident
> (since it had no effect on af_unix sockets) and this might break after
> this patch.
>
> Signed-off-by: Eric Dumazet <eric.dumazet@...il.com>
> Tested-by: Piergiorgio Beruto <piergiorgio.beruto@...il.com>
> CC: Michael Kerrisk <mtk.manpages@...il.com>
Patch below to man-pages applied.
Thanks for CCing me, Eric.
Cheers,
Michael
--- a/man2/recv.2
+++ b/man2/recv.2
@@ -264,7 +264,7 @@ subsequent receive call will return the same data.
For raw
.RB ( AF_PACKET ),
Internet datagram (since Linux 2.4.27/2.6.8),
-and netlink (since Linux 2.6.22) sockets:
+netlink (since Linux 2.6.22) and UNIX datagram (since Linux 3.4) sockets:
return the real length of the packet or datagram,
even when it was longer than the passed buffer.
Not implemented for UNIX domain
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists