From owner-svn-src-head@FreeBSD.ORG Sat May 9 20:46:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD2911065670; Sat, 9 May 2009 20:46:08 +0000 (UTC) (envelope-from dchagin@dchagin.static.corbina.ru) Received: from contrabass.post.ru (contrabass.post.ru [85.21.78.5]) by mx1.freebsd.org (Postfix) with ESMTP id 2D28B8FC1B; Sat, 9 May 2009 20:46:07 +0000 (UTC) (envelope-from dchagin@dchagin.static.corbina.ru) Received: from corbina.ru (mail.post.ru [195.14.50.16]) by contrabass.post.ru (Postfix) with ESMTP id 2068E99675; Sun, 10 May 2009 00:46:06 +0400 (MSD) X-Virus-Scanned: by cgpav Uf39PSi9pFi9oFi9 Received: from [10.208.17.3] (HELO dchagin.static.corbina.ru) by corbina.ru (CommuniGate Pro SMTP 5.1.14) with ESMTPS id 1779600641; Sun, 10 May 2009 00:46:06 +0400 Received: from dchagin.static.corbina.ru (localhost.chd.net [127.0.0.1]) by dchagin.static.corbina.ru (8.14.3/8.14.3) with ESMTP id n49Kk5LL004809; Sun, 10 May 2009 00:46:05 +0400 (MSD) (envelope-from dchagin@dchagin.static.corbina.ru) Received: (from dchagin@localhost) by dchagin.static.corbina.ru (8.14.3/8.14.3/Submit) id n49KjxYu004808; Sun, 10 May 2009 00:45:59 +0400 (MSD) (envelope-from dchagin) Date: Sun, 10 May 2009 00:45:59 +0400 From: Chagin Dmitry To: Bruce Evans Message-ID: <20090509204559.GA4626@dchagin.static.corbina.ru> References: <200905071424.n47EOos1058369@svn.freebsd.org> <20090508111302.C1275@besplex.bde.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="HcAYCG3uE/tztfnV" Content-Disposition: inline In-Reply-To: <20090508111302.C1275@besplex.bde.org> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191883 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 May 2009 20:46:09 -0000 --HcAYCG3uE/tztfnV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 08, 2009 at 11:45:16AM +1000, Bruce Evans wrote: > On Thu, 7 May 2009, Dmitry Chagin wrote: >=20 > > Log: > > Linux exports HZ value to user space via AT_CLKTCK auxiliary vector en= try, > > which is available for Glibc as sysconf(_SC_CLK_TCK). If AT_CLKTCK ent= ry is > > not exported, Glibc uses 100. >=20 > This cannot work for older applications/glibc's that have CLK_TCK hard-co= ded. >=20 yes, I know. Glibc versions prior to 2.2.1 uses hardcoded CLK_TCK value. > > linux_times() shall use the value that is exported to user space. >=20 > FreeBSD handles the problem by "exporting" the old constant value of CLK_= TCK > (128) although this value has always been bogus and the "export" is actua= lly > hard-coded into libc:sysconf() (and into except in post-2001 > pure-POSIX case -- in particular, the bogus macro CLK_TCK is still hard- > coded to the bogus value 128 in the BSD_VISIBLE case to avoid breaking > bogus BSD applications that use it). >=20 > > Modified: head/sys/compat/linux/linux_misc.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/sys/compat/linux/linux_misc.c Thu May 7 13:49:48 2009 (r19188= 2) > > +++ head/sys/compat/linux/linux_misc.c Thu May 7 14:24:50 2009 (r19188= 3) > > @@ -659,9 +659,7 @@ struct l_times_argv { > > l_clock_t tms_cstime; > > }; > > > > -#define CLK_TCK 100 /* Linux uses 100 */ > > - > > -#define CONVTCK(r) (r.tv_sec * CLK_TCK + r.tv_usec / (1000000 / CLK_TC= K)) > > +#define CONVTCK(r) (r.tv_sec * hz + r.tv_usec / (1000000 / hz)) >=20 > hz has very little to do with statistics clock ticks. The frequency of t= he > statistics clock in FreeBSD is given by stathz. stathz will normally only > equal hz if the statistics clock is the same as the scheduling clock. > stathz is a bogus value too since the clock most relevant for them is the > cputicker and the statistics clock is only used to divide them up. >=20 Thank you! > Anyway, this patch is backwards. The bug was that the value exported to > user space didn't match the value here. The value cannot be changed in hmm, r189362. hz exported to user space via AT_CLKTCK. > either FreeBSD or Linux without breaking compatibility. It is even > harder to change in emulators than in a full O/S distribution since the > full distribution can more reasonably drop support for all old > applications. A correct emulator would have to have an array of values > for each "constant" sysconf() value with the arrays index by the O/S > version and maybe the libc version being emulated :-(. >=20 I will try to make the hard-coded CLK_TCK support. It will depend on value of compat.linux.osrelease (2.2 I guess). --=20 Have fun! chd --HcAYCG3uE/tztfnV Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (FreeBSD) iEYEARECAAYFAkoF64cACgkQ0t2Tb3OO/O2wcgCdH1PhcLiJT9gDouR/lB38J4qT J20An3FOzMSWCi8G3+kRGv9E3tGTDB3T =sW/f -----END PGP SIGNATURE----- --HcAYCG3uE/tztfnV--