On Wed, Dec 28, 2022 at 08:23:57AM -0700, Todd C. Miller wrote: > On Wed, 28 Dec 2022 06:51:52 -0600, Scott Cheloha wrote: > > > On Sat, Dec 10, 2022 at 08:09:15AM -0600, Scott Cheloha wrote: > > > As with e.g. kstat(1), implementing a periodic display with > > > nanosleep(2) causes the display interval to drift. Doing it with > > > setitimer(2) prevents drift. > > > > > > ok? > > Looks fine to me. I don't see a reason to change the max interval > though--both values appear arbitrary.
Neither are arbitrary. The current maximum of one hundred million seconds is based on the old nanosleep(2) limit prior to the 6.5 release. It was a documented limit; see the manpage from the 6.4 release: http://man.openbsd.org/OpenBSD-6.4/nanosleep.2 setitimer(2) accepts intervals up to UINT_MAX seconds. This is not documented yet, but I have a rewrite for getitimer.2 in the works. The kernel enforces it in itimerfix(): https://github.com/openbsd/src/blob/2b46a8cbba384f799321fc554d4d1c95563ea0a2/sys/kern/kern_time.c#L711