Date: Tue, 1 Feb 2011 11:04:19 -0800 From: Garrett Cooper <gcooper@FreeBSD.org> To: Martin Matuska <mm@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r218169 - head/sys/cddl/compat/opensolaris/sys Message-ID: <AANLkTimDBdraZaHsQjEmAB5qDk9nEnKhaGmf%2B1atZL%2B4@mail.gmail.com> In-Reply-To: <201102011428.p11ESoQw074786@svn.freebsd.org> References: <201102011428.p11ESoQw074786@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Feb 1, 2011 at 6:28 AM, Martin Matuska <mm@freebsd.org> wrote: > Author: mm > Date: Tue Feb 1 14:28:50 2011 > New Revision: 218169 > URL: http://svn.freebsd.org/changeset/base/218169 > > Log: > 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: http://p4db.freebsd.org/fileViewer.cgi?FSPC=//depot/user/gcooper/posix-conformance-work/sys/cddl/compat/opensolaris/sys/time.h&REV=3 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 :/...). Thanks! -Garrett
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTimDBdraZaHsQjEmAB5qDk9nEnKhaGmf%2B1atZL%2B4>