On Tue, 05 Jun 2018 16:30:14 -0500, Scott Cheloha wrote:

> Because the system clock can jump around, process start times
> should be recorded as offsets from boot and only converted to
> a time of day on request.
> This keeps ps(1)'s etime accurate and ensures processes are
> correctly sorted by age in ps(1) and pgrep(1).

Looks good.

> I don't think we're losing much by declining to preserve the
> time of day when the process forked.
> FreeBSD has made this change, though NetBSD has not.
> The attached patch isn't perfect, as there remains a small window
> after kvm_getprocs is called where the system clock can jump again.
> To circumvent that we'd need to compute the elapsed real time for
> the process in the kernel, or pass out ps_start alongside the derived
> time of day and let userspace compute the elapsed realtime with
> the CLOCK_BOOTTIME clock.  Unsure how people feel about extending
> kinfo_proc, though.

I really don't this is worth worrying about.  In the current state
of things, if the system clock jumps the process start time as
reported by ps will be incorrect anyway.  This seems like an

> This change doesn't require any userspace recompilation for inspecting
> a live kernel: on reboot -lkvm binaries behave as expected.

Great.  I was worried that consumers of p_ustart_{sec,usec} would
need to change but I can see that is not the case.

 - todd

Reply via email to