sbintime_t in userland

Ian Lepore ian at freebsd.org
Sat Nov 28 15:53:02 UTC 2020


I notice everything related to sbintime_t in sys/time.h is in the
public part of the header file (not protected by #ifdef _KERNEL).  As
near as I can tell, no existing userland software uses this type, and
no userland<->kernel APIs involve sbintime_t.

I have a situation where I need to timestamp events relative to each
other in the kernel and report those timestamps to userland. 
sbintime_t would be an ideal compact format for the data, and
sbinuptime() would be a fine way to obtain the timestamps in the
kernel.

Before breaking new ground like this I thought I'd solicit opinions: is
it a bad idea to export sbintime_t values from the kernel like this?

If it's considered okay, a second question would be: is it okay to
document that they are on the 'uptime timescale' (meaning userland
could translate them to UTC timestamps by determining the offset
between CLOCK_REALTIME and CLOCK_MONOTONIC)?

-- Ian




More information about the freebsd-arch mailing list