Any idea why timespec* is _KERNEL stuff only?

Xin LI delphij at frontfree.net
Wed Jul 21 08:14:21 PDT 2004


Hi, Bruce

On Wed, Jul 21, 2004 at 11:37:40PM +1000, Bruce Evans wrote:
> On Wed, 21 Jul 2004, Xin LI wrote:
> 
> > Hi, Poul-Henning,
> >
> > It seems that rev. 1.23 of sys/sys/time.h has constrained timespec* macros
> > to be _KERNEL (KERNEL in the old days) only. Is this intended? (NetBSD and
> 
> Yes, this is intended.  The timeval and timespec interfaces are optimized
> for handling times in code that can't use 64-bit integers or floating
> point (mainly in 20 year old kernels).  New interfaces to manipulate them
> should not be added 20 years after the interfaces should have been
> deprecated.
>
> > OpenBSD don't expect _KERNEL for these macros, e.g. timespeccmp, and I
> > personally think that these macros will be better for more generic use,
> 
> NetBSD and OpenBSD originally only had timeval*(), and FreeBSD unfortunately
> had to add them to be compatible.  timespec*() seem to be even less needed
> in userland than timeval*(), since no ports are broken by not having them.
> 
> > as timespec structure is not _KERNEL protected :-)
> 
> The timespec struct is POSIX standard.  POSIX has the correct number of
> functions for operating on timespec structs (none).

Thanks for the information, Bruce!

So this means I should use bintime instead of timespec if it is found in
code?

For the exact problem I went into: it's OpenBSD's cron which makes use of
timespec (because of fstat). I think a _KERNEL || __BSD_VISIBLE might be
helpful -- While it is possible to use bintime to represent what can be
done with a timespeccmp macro.

Cheers,
-- 
Xin LI <delphij frontfree net>	http://www.delphij.net/
See complete headers for GPG key and other information.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20040721/1965ac07/attachment.bin


More information about the freebsd-current mailing list