From owner-freebsd-net@freebsd.org Tue Jan 26 17:06:42 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 4969CA46284 for ; Tue, 26 Jan 2016 17:06:42 +0000 (UTC) (envelope-from rizzo.unipi@gmail.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 286A2E4B for ; Tue, 26 Jan 2016 17:06:42 +0000 (UTC) (envelope-from rizzo.unipi@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 2469FA46281; Tue, 26 Jan 2016 17:06:42 +0000 (UTC) Delivered-To: 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 09EEDA4627F; Tue, 26 Jan 2016 17:06:42 +0000 (UTC) (envelope-from rizzo.unipi@gmail.com) Received: from mail-lf0-x22e.google.com (mail-lf0-x22e.google.com [IPv6:2a00:1450:4010:c07::22e]) (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 836B8E4A; Tue, 26 Jan 2016 17:06:41 +0000 (UTC) (envelope-from rizzo.unipi@gmail.com) Received: by mail-lf0-x22e.google.com with SMTP id 17so109370043lfz.1; Tue, 26 Jan 2016 09:06:41 -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=T7mn27yqF1atfSp+7ckzRpZa1zBwI1gOyutZKeWlmxM=; b=q2EMl8waQS58+2uOklBQUv/pPLsmiv/ND6egaeORCqxZpWDgI4FzI62D3SlNh3l/Jy JVNrfq2KloZ4McIOAG7JzD+SMsEjwO79rA8BtErUlrfvSjkOdpcxVuDLUZYpxzNwlvZ1 MfEvZadIiO1BKzPvJdqD0QKuZIcMm3ovPARY/0lxJvc1avhoxIpYqx6rKpm32eMHKfMb gB/2CHzp8dJlQ5ZwU+K+KPLx7koipm2pFFDBgvpLPHhYMfumE+n46WZTMP98cEF03Q5P GRVNLOF9/wCtWM/1QrDHccVA5BWZ1jvhOUx0tDQaIj6buUTrviY7k+L8EkJW4mO/dewc mPYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=T7mn27yqF1atfSp+7ckzRpZa1zBwI1gOyutZKeWlmxM=; b=kUonTYDVpi5CYCSRd9osfXX7rXbCcPoYxykrTf1Fn6o/AvmU7IaMHltKtLr/q5cVjG 72MJ6AUt+z1N/+XXFsq0oblr3SfTydqNV4LaJ2J8WgQ8TvJaySovtwjNYmynL7HgTvoZ tIQqYvA8cnJkSW6RmGegbtT8cegi/b36vbRd76wpz3LxNhxSRq7mreNLEub002nliJi1 rX+2qsAp7+KWeSVGecE1J/ID/OOAZX3VfWvjI5BipoJh1kYLPIQSM1bxOSJC1zLixitq XlcjyvkR6uG+doPWUkSw+KT8uGKLtu+wZzw/jpMOij5j7lhavg0DYTn7hiAhsXnLiz/s 0DtA== X-Gm-Message-State: AG10YOQswa6q9quMRmrPqqWENeML38KIKViD2gR/0R+wYLFBwZgeYevcDGJ0l3vJbw3AI7sEvRYaZZMFqJ4ngQ== MIME-Version: 1.0 X-Received: by 10.25.209.138 with SMTP id i132mr9091992lfg.4.1453827999702; Tue, 26 Jan 2016 09:06:39 -0800 (PST) Sender: rizzo.unipi@gmail.com Received: by 10.114.4.232 with HTTP; Tue, 26 Jan 2016 09:06:39 -0800 (PST) In-Reply-To: <20160126134005.GD3942@kib.kiev.ua> References: <20160118140811.GW3942@kib.kiev.ua> <20160120073154.GB3942@kib.kiev.ua> <20160121093509.GK3942@kib.kiev.ua> <20160121233040.E1864@besplex.bde.org> <20160124050634.GS3942@kib.kiev.ua> <20160124100747.551f8e3f@ernst.home> <20160126134005.GD3942@kib.kiev.ua> Date: Tue, 26 Jan 2016 09:06:39 -0800 X-Google-Sender-Auth: Sd4U1kUTBPHiWaXKnzx4nXOeCtk Message-ID: Subject: Re: Does FreeBSD have sendmmsg or recvmmsg system calls? From: Luigi Rizzo To: Konstantin Belousov Cc: Boris Astardzhiev , threads@freebsd.org, gljennjohn@gmail.com, "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: Tue, 26 Jan 2016 17:06:42 -0000 On Tue, Jan 26, 2016 at 5:40 AM, Konstantin Belousov wrote: > On Mon, Jan 25, 2016 at 11:22:13AM +0200, Boris Astardzhiev wrote: >> +ssize_t >> +recvmmsg(int s, struct mmsghdr *__restrict msgvec, size_t vlen, int flags, >> + const struct timespec *__restrict timeout) >> +{ >> + size_t i, rcvd; >> + ssize_t ret; >> + >> + if (timeout != NULL) { >> + fd_set fds; >> + int res; > Please move all local definitions to the beginning of the function. This style recommendation was from 30 years ago and is bad programming practice, as it tends to complicate analysis for the human and increase the chance of improper usage of variables. We should move away from this for new code. cheers luigi