headers that use "struct bintime"

Poul-Henning Kamp phk at phk.freebsd.dk
Mon May 28 06:36:12 UTC 2012

In message <20120528023818.F2417 at besplex.bde.org>, Bruce Evans writes:

>devstat has silly APIs, with long double values (despite needing the
>range and precision of long doubles over doubles less than most things)
>and bintimes (despite needing the precision of bintimes over less than
>most things), but is well established so is hard to fix now.

I take it you meant to write:  devstat wisely chose sufficiently
powerful data types to cover a significant of stretch of future,
rather than fall in the all too common trap of skimping on data
types for the sake of a few bytes ?

>Headers with softcs in them
>never belonged in <sys>, and softcs never belonged in public APIs,

Well, that's pretty much how ioctls worked on very early versions
of Unix, but I agree with you that it was architecturally wrong.

>I wonder why scsi is still doing so much with devstat.  For disks,
>devstat handling mostly moved into geom.

Mainly because SCSI also does tapes, and non-GEOM operations, such
as formatting, on disks.

I should have severed that link when I did GEOM, splitting
devicestat into geomstat and camstat.

Doing so now would still be a good idea.

>I think libdevstat
>just uses a sysctl that converts kernel struct devicestats into
>userland struct devstat, so userland should never see the former.

It mmaps /dev/devstat, so it is slightly more tangled.

Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

More information about the freebsd-arch mailing list