Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Aug 2011 12:09:01 +0000
From:      Alexander Best <arundel@freebsd.org>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dimitry Andric <dim@freebsd.org>, Jonathan Anderson <jonathan@freebsd.org>
Subject:   Re: svn commit: r224721 - head/sys/sys
Message-ID:  <20110815120901.GC21258@freebsd.org>
In-Reply-To: <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> <20110815013423.E2968@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon Aug 15 11, Bruce Evans wrote:
> 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 <sys/time.h> (where 4.4BSD-Lite
>    put them) to <sys/timespec.h>.  This is not incorrect (since <sys/time.h>
>    is an old header that should only declare timeval interfaces (POSIX
>    put timespec interfaces in <time.h>).  However, the move became out of
>    date before it was done (in 2001) because <sys/time.h> had already
>    grown several other timespec interfaces which were not moved.  But these
>    were kernel-only, so they didn't cause namespace problems.  Now
>    <sys/time.h> has grown several more user timespec interfaces.

thanks for the explanation. :)

> 
> Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110815120901.GC21258>