CVSROOT:        /cvs
Module name:    src
Changes by:     chel...@cvs.openbsd.org 2022/07/25 22:07:13

Modified files:
        lib/libc/gmon  : gmon.c 

Log message:
moncontrol(3): remove hertz() fallback function

In the moncontrol(3) code in libc there is a fallback function,
hertz().  The idea is, if getting kern.clockrate from sysctl(2) fails,
we fall back to deriving the value of hz(9) using setitimer(2)'s
rounding behavior.

This is extremely clever, but it actually sucks.  Calling setitimer(2)
quietly cancels any extant ITIMER_REAL timer, so moncontrol(3) cannot
be safely used alongside setitimer(2).  This fact is not documented.

kern.clockrate is not blocked by pledge(2), so outside of stack
corruption (which we can't do anything about anyway) I don't see a way
for the sysctl(2) call to ever fail on OpenBSD.  So hertz() is also
pointless.

Hence this patch: get rid of hertz().

Thread: https://marc.info/?l=openbsd-tech&m=163881542813633&w=2

ok guenther@

Reply via email to