Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Feb 2012 23:10:32 +0400
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        svn-src-projects@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: svn commit: r232044 - projects/pf/head/sys/sys
Message-ID:  <20120223191032.GW92625@FreeBSD.org>
In-Reply-To: <20120224034735.T1834@besplex.bde.org>
References:  <201202231019.q1NAJObb099152@svn.freebsd.org> <20120224034735.T1834@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
  Bruce,

On Fri, Feb 24, 2012 at 04:30:53AM +1100, Bruce Evans wrote:
B> This is the old Net/2 and 4.4BSD API (extended).  One of the bugs in
B> it is that it users the generic name `timer' for just one of the types
B> of time-related structures, and even that type is time-related, not
B> always timer-related.  This timeval type should have gone away with POSIX
B> timespecs in 1988, so it is the one least deserving of the generic name.
B> 
B> FreeBSD started fixing this in 1998 by renaming the above to timeval*()
B> in the kernel.  Unfortunately, the old APIs remained as compatibility
B> cruft for userland (now under ifdefs).  FreeBSD also added timespec*()
B> macros in 1998.
B> 
B> timevaladd() and timevalsub() were correctly spelled and correctly
B> implemented as functions in FreeBSD-1.  FreeBSD extended the old
B> mistakes in 1996 by adding timeradd() and timersub() macros for NetBSD
B> userland compatibility.  These are heavier-weight and otherwise more
B> suitable for being functions than the others, so they were only
B> functions, and were correctly named too.  timespecadd() and
B> timespecsub() are simalarly better implemented as functions, but FreeBSD
B> added macros for them in 1998, while intentionally not doing this for
B> timevaladd() and timevalsub().  But there is a problem with any of
B> these API being functions in userland, since the functions have never
B> been in libc.  Hacking on time.h is easier than adding them in libc.
B> Even correct hacking on time.h for them would be easier than changing
B> libc.  The 1996-2012 hacking is missing visibility ifdefs, and gives
B> unsafe macros although their names indicate that they are safe.
B> 
B> POSIX extended the lifetime of timevals by standardizing them 2001.
B> 13 years wasn't long enough for them to go away.  Now, 24 years hasn't
B> been long enough.

Thanks for important comments. Is the fix in r232062 okay?

-- 
Totus tuus, Glebius.



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