From owner-svn-src-head@FreeBSD.ORG Sun Aug 14 15:53:30 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0100D106564A; Sun, 14 Aug 2011 15:53:30 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.freebsd.org (Postfix) with ESMTP id 862548FC0A; Sun, 14 Aug 2011 15:53:29 +0000 (UTC) Received: from c122-106-165-191.carlnfd1.nsw.optusnet.com.au (c122-106-165-191.carlnfd1.nsw.optusnet.com.au [122.106.165.191]) by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p7EFrQxv020729 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 15 Aug 2011 01:53:27 +1000 Date: Mon, 15 Aug 2011 01:53:26 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alexander Best In-Reply-To: <20110810154956.GA4034@freebsd.org> Message-ID: <20110815013423.E2968@besplex.bde.org> References: <201108082036.p78KarlR062810@svn.freebsd.org> <20110809105824.P896@besplex.bde.org> <20110810103831.GA60858@freebsd.org> <20110810230856.M2222@besplex.bde.org> <20110810154956.GA4034@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, Dimitry Andric , Bruce Evans , svn-src-head@freebsd.org, Jonathan Anderson Subject: Re: svn commit: r224721 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 15:53:30 -0000 On Wed, 10 Aug 2011, Alexander Best wrote: > On Wed Aug 10 11, Bruce Evans wrote: >> On Wed, 10 Aug 2011, Alexander Best wrote: >>> any reason {TIMEVAL,TIMESPEC}_TO_{TIMESPEC,TIMEVAL}()s code is being >>> executed >>> in a >>> >>> do { ... } while (0) >>> >>> conditional loop? >> >> Just the usual syntactical trick for making large macros that look >> like function calls almost usable like function calls. Without the > ... > thanks a lot for the in depth information. :) any reason, back in the days, it > was decided that the functionality of converting a timespec to a timeval and > vice versa should be implemented as a macro and not a function? Macros avoid some namespace pollution problems, and all the old kernel timeval manipulation interfaces are either extern functions or macros, partly because inline functions didn't exist when these interfaces were designed. But the TIME* macros still have gratuitously different styles: 1) they are spelled in upper case (which is "correct" since they are unsafe macros, but this is not done for the other timeval macros which are almost all unsafe) 2) FreeBSD moved their definitions from (where 4.4BSD-Lite put them) to . This is not incorrect (since is an old header that should only declare timeval interfaces (POSIX put timespec interfaces in ). However, the move became out of date before it was done (in 2001) because had already grown several other timespec interfaces which were not moved. But these were kernel-only, so they didn't cause namespace problems. Now has grown several more user timespec interfaces. Bruce