From owner-freebsd-net@freebsd.org Thu Jan 7 10:56:56 2016 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F134BA65F94 for ; Thu, 7 Jan 2016 10:56:56 +0000 (UTC) (envelope-from rizzo.unipi@gmail.com) Received: from mail-lb0-x22d.google.com (mail-lb0-x22d.google.com [IPv6:2a00:1450:4010:c04::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7AF6D1E92 for ; Thu, 7 Jan 2016 10:56:56 +0000 (UTC) (envelope-from rizzo.unipi@gmail.com) Received: by mail-lb0-x22d.google.com with SMTP id pv2so221194692lbb.1 for ; Thu, 07 Jan 2016 02:56:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=jjBs39r6n8jOrSeIHdwXD5zsZq7OIY7t66Sq64pbXiQ=; b=hGANXI8xlN9CQEeGKV8T9Vxq6tagiqmZZv1eBsVB6/5wizYHdOnqXoAi9JsvX8079D g4W/pYyLRaZtCsWxoea9Qsa7Xf4myDSgqCeWfPm8FGcLO5rmpBiiuZIPaNLl/on6j6Cs rGxhNnfWMqI7LuVnlDR2kP9VetlRIJzApKuxZ6R1qEebJfgIP3P6b9yj2qmY3+/vfCTl YQZVe3rnT/epvSB/y4Kp0DXWCL3ljh3Qn1W9qX0CvT4AYJfWBIwyqrnTo7dkKspb50PS FCS8KQEwZGQmFFozQs8vqYORIpCbdbLDf339qpXTrLNxQep7ncxNIBNPJO8AmzaqjERY Z1bA== MIME-Version: 1.0 X-Received: by 10.112.45.138 with SMTP id n10mr30578264lbm.100.1452164212996; Thu, 07 Jan 2016 02:56:52 -0800 (PST) Sender: rizzo.unipi@gmail.com Received: by 10.114.13.33 with HTTP; Thu, 7 Jan 2016 02:56:52 -0800 (PST) In-Reply-To: References: <1451841004.10139.34.camel@me.com> <20160103214720.72014.qmail@f5-external.bushwire.net> <20160104085415.GS3625@kib.kiev.ua> <20160104091108.50654.qmail@f5-external.bushwire.net> <20160104093859.GV3625@kib.kiev.ua> <20160104101747.58347.qmail@f5-external.bushwire.net> <20160104194044.GD3625@kib.kiev.ua> <20160104210741.32812.qmail@f5-external.bushwire.net> Date: Thu, 7 Jan 2016 02:56:52 -0800 X-Google-Sender-Auth: 3Z8c-OnbKjVAFt-yWgrrGRJ24z4 Message-ID: Subject: Re: Does FreeBSD have sendmmsg or recvmmsg system calls? From: Luigi Rizzo To: Boris Astardzhiev Cc: Mark Delany , "freebsd-net@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2016 10:56:57 -0000 Hi Boris, thanks for working on this. A few comments: - do you have any performance data on calling *mmsg() versus multiple invocations of the equivalent *msg() ? - in the following chunk in recvmmsg.c , there are slight type differences between the function and the internal cast. Same in sendmmsg.c +ssize_t +recvmmsg(int s, struct mmsghdr *msgvec, unsigned int vlen, int flags) +{ + + return (((int (*)(int, struct mmsghdr *, int, int)) + __libc_interposing[INTERPOS_recvmmsg])(s, msgvec, vlen, flags)); +} - why did you add a cap_rights_init() to the functions when neither sendmsg or recvmsg have it (in other words, this is a worthwhile addition but perhaps should be done later - the initial part of the two functions sys_*mmsg() is almost exactly the same so can you define a function with the common code ? - you could probably avoid the repeated malloc/free of the iov with a first loop that finds the max iov size and does the allocation only once. copyiniov can then be replaced by a copyin - (minor) what is the point of copying the current entry into msg rather than just using mp-> ... - can you add a comment explaining why you do the following error = copyout(&td->td_retval[0], &uap->msgvec[i].msg_len, sizeof(td->td_retval[0])); cheers luigi On Thu, Jan 7, 2016 at 1:51 AM, Boris Astardzhiev wrote: > Hello, > > Here's my implementation of the two system calls. The patch is against HEAD > from a couple of days: > commit ff9e83788d7ed52342dcba4dff1e62fdf3cc985c > Author: ngie > Date: Mon Jan 4 03:34:22 2016 +0000 > > Remove free'ing of an uninitialized variable > > Just remove it completely from the test as it's initialized but unused > apart > from the free(3) call > > Differential Revision: https://reviews.freebsd.org/D4769 (part of > larger diff) > MFC after: 5 days > Reported by: cppcheck > Reviewed by: oshogbo > Sponsored by: EMC / Isilon Storage Division > > I've made brief tests using the examples in the manpages in Linux skipping > the timeout stuff: > http://man7.org/linux/man-pages/man2/sendmmsg.2.html > http://man7.org/linux/man-pages/man2/recvmmsg.2.html > > I've tried to stick to the comments in the thread but any > suggestions/testings > are also welcomed so that I can fix the calls accordingly. > > Regards, > Boris Astardzhiev > > > On Mon, Jan 4, 2016 at 11:07 PM, Mark Delany wrote: > >> > You just repeat arguments for the text in my messages, which you removed >> > on reply. >> >> My goal is to get you to scruitinize. >> >> Thank you for helping. >> >> >> Mark. >> _______________________________________________ >> freebsd-net@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/freebsd-net >> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" >> > > _______________________________________________ > freebsd-net@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" -- -----------------------------------------+------------------------------- Prof. Luigi RIZZO, rizzo@iet.unipi.it . Dip. di Ing. dell'Informazione http://www.iet.unipi.it/~luigi/ . Universita` di Pisa TEL +39-050-2217533 . via Diotisalvi 2 Mobile +39-338-6809875 . 56122 PISA (Italy) -----------------------------------------+-------------------------------