Subject: Re: CVS commit: basesrc/include
To: Perry E. Metzger <perry@piermont.com>
From: Ben Harris <bjh21@netbsd.org>
List: tech-userlevel
Date: 06/24/2002 16:37:54
On 24 Jun 2002, Perry E. Metzger wrote:
> > For example, our /bin/ksh has a "times" builtin that uses CLK_TCK to scale
> > the results of times().
>
> I'd strongly suggest we fix that to use getrusage.
Agreed. This doesn't help with existing binaries, though
> It is one of only two apps that actually use times in our sources,
> actually.
What's the other? Presumably it should use getrusage too.
> > 2: Changing _SC_CLK_TCK so that the old version still returns a constant
> > 100, while the new one returns something variable. This will save
> > versioning sysconf.
>
> I don't think that is necessary -- old sources assume CLK_TCK, as was
> defined in the old POSIX, and not _SC_CLK_TCK. Anything properly using
> _SC_CLK_TCK is new.
Erm, _SC_CLK_TCK has been in POSIX since 1996 at least. In ISO/IEC
9945-1:1996, it's defined on page 111, line 439. There's no change bar on
that line, which I think means it was the same in ISO/IEC 9945-1:1990, and
hence in IEEE Std 1003.1-1990. The same is true of the text on page 112
line 508 which deprecated CLK_TCK. Thus, applications written to conform
to POSIX in the last twelve years should be using _SC_CLK_TCK, while
applications written with reference to our manual page will use CLK_TCK.
Breaking either of these seems suboptimal to me.
> > I might have some spare time to do this myself in the near future, if it's
> > agreed to be a good idea.
>
> I'm very unsure it is. We are talking about something that really,
> really impacts almost nothing. I suspect that no one would actually
> notice except for our paranoia about it.
Perhaps. I feel that this is an instance of "if a thing's worth doing,
it's worth doing right", so if we're going to provide times(), we should
do so with full backward-compatibility.
--
Ben Harris <bjh21@netbsd.org>
Portmaster, NetBSD/acorn26 <URL:http://www.netbsd.org/Ports/acorn26/>