svn commit: r218169 - head/sys/cddl/compat/opensolaris/sys
gcooper at FreeBSD.org
Tue Feb 1 19:04:22 UTC 2011
On Tue, Feb 1, 2011 at 6:28 AM, Martin Matuska <mm at freebsd.org> wrote:
> Author: mm
> Date: Tue Feb 1 14:28:50 2011
> New Revision: 218169
> URL: http://svn.freebsd.org/changeset/base/218169
> For ZFS, change the type of clock_t to int64_t.
> The clock_t type in OpenSolaris is long (int64_t on amd64).
> On FreeBSD clock_t is int32_t. The clock_t type is used in several places
> in the ZFS code to store system uptime in milliseconds ("seconds * hz").
> With hz=1000 we have a 32-bit integer overflow in 24 days, 20 hours,
> 31 minutes and 23.648 seconds. This has a user reported negative impact
> on l2arc_feed_thread() and may cause unexpected results from other functions
> using clock_t.
This change broke the build. This header is also nasty because it
doesn't conform to POSIX. Here's what I did to resolve the POSIX API
issues at least:
If you're going to redefine clock_t though, please define
_CLOCK_T_DECLARED, but note that this will cause issues with ABI
conformance across the board as FreeBSD defines it as one thing and
Solaris defines it as another (so there might be some issues where
FreeBSD and the opensolaris compat crossover).
clock_t should be bumped to 64-bit on FreeBSD though IMO (based on
the issues encountered and the utility in functions like clock(3)),
but it might have some trickledown impact as filesystem datastructures
(for instance) won't change size as they're on-disk structures (as I
discovered several weeks ago when I proposed that the chflags syscalls
be made consistent on FreeBSD :/...).
More information about the svn-src-all