Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Jan 2011 01:03:52 -0800
From:      Artem Belevich <fbsdlist@src.cx>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        freebsd-fs <freebsd-fs@freebsd.org>
Subject:   Re: ZFS: clock_t overflow in l2arc_feed_thread
Message-ID:  <AANLkTin-myEBeqyXb2YSfTVikcNA%2BFFtnH9650QtDmJn@mail.gmail.com>
In-Reply-To: <20110131160644.P2539@besplex.bde.org>
References:  <AANLkTikciV_XHvrurytr0-r11W4u=_p5bRi-xfX3S%2BQm@mail.gmail.com> <4D443407.7010604@FreeBSD.org> <AANLkTikASEbWQRsZr%2BMHth-jzbskwt4P14mXjCjdZrPk@mail.gmail.com> <4D45F359.4040402@FreeBSD.org> <20110131160644.P2539@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jan 30, 2011 at 9:25 PM, Bruce Evans <brde@optusnet.com.au> wrote:
> On Mon, 31 Jan 2011, Martin Matuska wrote:
>
>> I have re-checked OpenSolaris, and discovered that long is a int32_t.

Not true. It's 'long' which would be int64_t on LP64 and int32_t on ILP32
http://src.opensolaris.org/source/search?q=3D&project=3Donnv&defs=3Dclock_t=
&refs=3D&path=3D&hist=3D

> Why be different from both OpenSolaris and FreeBSD? =A0clock_t is 32 bits
> on all, and only bogusly signed on some.

See above.

> Also, there must be another bug for overflow to occur after only 24 days.
> clock_t is only specified for holding statclock ticks, which have a
> frequency of about 128 Hz, so 32-bit unsigned ints hold 388 days of ticks=
.

clock_t is used in solaris code to hold LBOLT (rough equivalent of
*uptime() in FreeBSD). When the code was ported to FreeBSD, LBOLT was
implemented so that it holds uptime in HZ ticks. HZ happens to be
1000, so clock_t as implemented on FreeBSD will overflow in 24 days.


--Artem



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTin-myEBeqyXb2YSfTVikcNA%2BFFtnH9650QtDmJn>