From patchwork Thu Dec 20 16:50:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael Kerrisk \\(man-pages\\)" X-Patchwork-Id: 207685 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id F18212C008A for ; Fri, 21 Dec 2012 03:51:11 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751537Ab2LTQvK (ORCPT ); Thu, 20 Dec 2012 11:51:10 -0500 Received: from mail-ie0-f172.google.com ([209.85.223.172]:61128 "EHLO mail-ie0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750933Ab2LTQvH (ORCPT ); Thu, 20 Dec 2012 11:51:07 -0500 Received: by mail-ie0-f172.google.com with SMTP id c13so4877594ieb.17 for ; Thu, 20 Dec 2012 08:51:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=4nUfo9hz8unl4KpBZbEEKJYmogXx1UVYQiuiY9oKvPk=; b=IqgV2GAE4Km7FLcZ88xiUz6fKIW7aTXQSyah1ZUoXnfkMhOXoE/ubsC0UpXts6K4Na jNlQ3LfqvTJqItdkJ73yT08JL29r4l/39qyEsrrOUG4oOSZqX0ibVbYdqHe4VpuoLA7p RKBkrxOiKdSmkA5O6OjwJC1BYZ3c87VccQhNjKm8EIOKNqaATfXd/q0izKFBLHivpVNr 5nsTFKqD5R2i1IxztJG2in3Mi6WbHNP4e8N6M5WLiDZCc5XZb6nEjfYFsa2LOPLZZf0c XBvWnk/ELkUOyW9aWmZWtBnnEKPeiCoBdJznX/mOtAa/3JLTpt8z6nGNRBKhj/wpxP3n j5sw== Received: by 10.50.53.147 with SMTP id b19mr10862046igp.12.1356022266728; Thu, 20 Dec 2012 08:51:06 -0800 (PST) MIME-Version: 1.0 Received: by 10.50.171.39 with HTTP; Thu, 20 Dec 2012 08:50:46 -0800 (PST) Reply-To: mtk.manpages@gmail.com In-Reply-To: <1329902695.18384.101.camel@edumazet-laptop> References: <1329287109.2555.44.camel@edumazet-laptop> <1329309727.2437.13.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC> <20120215.145511.1269077904303781879.davem@davemloft.net> <1329902695.18384.101.camel@edumazet-laptop> From: "Michael Kerrisk (man-pages)" Date: Thu, 20 Dec 2012 17:50:46 +0100 Message-ID: Subject: Re: [PATCH net-next] af_unix: MSG_TRUNC support for dgram sockets To: Eric Dumazet Cc: David Miller , piergiorgio.beruto@gmail.com, netdev@vger.kernel.org Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, Feb 22, 2012 at 10:24 AM, Eric Dumazet 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 > Tested-by: Piergiorgio Beruto > CC: Michael Kerrisk Patch below to man-pages applied. Thanks for CCing me, Eric. Cheers, Michael --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 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