From owner-freebsd-threads@freebsd.org Tue Jan 26 17:25:49 2016 Return-Path: Delivered-To: freebsd-threads@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 4BAFCA46DA6 for ; Tue, 26 Jan 2016 17:25:49 +0000 (UTC) (envelope-from gljennjohn@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 274E21ACD for ; Tue, 26 Jan 2016 17:25:49 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 2434FA46DA4; Tue, 26 Jan 2016 17:25:49 +0000 (UTC) Delivered-To: threads@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 098C7A46DA1; Tue, 26 Jan 2016 17:25:49 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: from mail-wm0-x236.google.com (mail-wm0-x236.google.com [IPv6:2a00:1450:400c:c09::236]) (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 91D251AC6; Tue, 26 Jan 2016 17:25:48 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: by mail-wm0-x236.google.com with SMTP id b14so142511573wmb.1; Tue, 26 Jan 2016 09:25:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references:reply-to :mime-version:content-type:content-transfer-encoding; bh=8XIw2Nll9Ro6yeMO3HrnJVLdR/wuR5XxJEjlFlClc0I=; b=oi+IQZr3W9GlbszJVZ7+MX8Wsz5ZtU5FiMtZxDfhioTKqG8p3lWmwQz/ra5UFx7aT7 DucMBem1qSODsde0nZ8vjUEKJ6c/kLyLbjpL7AbOPTodWXFPR3JIFUKdaqwQHQt4Jdvw rdtwG6BrfgsPh7XzWGmZ0qt0LkXvxSFwggswbK1uKMjQgtIlSCLDLFmQruU0Zw8sYOOz K6LuLakCwL7o8tlNzclYZayYxO2c+XVr2KotUh5QYwKZZGWH2U36wcvLb3NL/4GqdJNt UBxbLmGvj2hixVQ4xKfeFtcTxNpPyAYKJ5uEMPA/N/96Jlj63UiRAXIVaIzxYqiAU6KG BAVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:reply-to:mime-version:content-type :content-transfer-encoding; bh=8XIw2Nll9Ro6yeMO3HrnJVLdR/wuR5XxJEjlFlClc0I=; b=P4JQNnYgPCBnBnoxdWcDP+UADVwspUkDCLiYwapdWxKKpxOERHtuwHwzIY1Jintpva CMKNMlyPhSCeWRL67c8dJdjsG3uyQO5+vXVxTQRXRBImXz7QvZDTW3xwU3Fg1zQGbmdC xj+Afrwn3IVUPdSaq7MzGC8O51yji69JdidzL2aD63H2io3bqq8E2i9aIVZQozTLLtsg xX8hUgJ9ogxiGYvHOR0zse8WRWwnS/Kt1z303irZoYkDZXHeFeZ7FClGAE1XDg4ZiaKf U7PdopkXPPPganVMvenG7Zd5Qw9rTPHRUkIfV4wSYElYQWKVq8KL3ZTjPpwfo1KlPSaJ oRKg== X-Gm-Message-State: AG10YOTDDKZQ57UzBXs+OvpBkLcQHUcgeehm2xqxkFn1JMxEvdkjTywpRrp/w72gBNaTZg== X-Received: by 10.194.95.34 with SMTP id dh2mr23779246wjb.63.1453829147025; Tue, 26 Jan 2016 09:25:47 -0800 (PST) Received: from ernst.home (p4FCA7371.dip0.t-ipconnect.de. [79.202.115.113]) by smtp.gmail.com with ESMTPSA id js8sm2351923wjc.37.2016.01.26.09.25.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Jan 2016 09:25:45 -0800 (PST) Date: Tue, 26 Jan 2016 18:25:43 +0100 From: Gary Jennejohn To: Luigi Rizzo Cc: Konstantin Belousov , Boris Astardzhiev , threads@freebsd.org, "freebsd-net@freebsd.org" Subject: Re: Does FreeBSD have sendmmsg or recvmmsg system calls? Message-ID: <20160126182543.64050678@ernst.home> In-Reply-To: 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> Reply-To: gljennjohn@gmail.com X-Mailer: Claws Mail 3.13.1 (GTK+ 2.24.29; amd64-portbld-freebsd11.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jan 2016 17:25:49 -0000 On Tue, 26 Jan 2016 09:06:39 -0800 Luigi Rizzo wrote: > 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. > Really? I personally find having all variables grouped together much easier to understand. Stumbling across declarations in the middle of the code in a for-loop, for example, takes me by surprise. I also greatly dislike initializing variables in their declarations. Maybe I'm just old fashioned since I have been writing C-code for more than 30 years. -- Gary Jennejohn