// From NetBSD's <sys/sysctl.h>
const (
- _CTL_KERN = 1
- _KERN_OSREV = 3
-
_CTL_HW = 6
_HW_NCPU = 3
_HW_PAGESIZE = 7
return 0
}
-func getOSRev() int {
- if osrev, ok := sysctlInt([]uint32{_CTL_KERN, _KERN_OSREV}); ok {
- return int(osrev)
- }
- return 0
-}
-
//go:nosplit
func semacreate(mp *m) {
}
if physPageSize == 0 {
physPageSize = getPageSize()
}
- needSysmonWorkaround = getOSRev() < 902000000 // NetBSD 9.2
}
var urandom_dev = []byte("/dev/urandom\x00")
// This is a variable for testing purposes. It normally doesn't change.
var forcegcperiod int64 = 2 * 60 * 1e9
-// needSysmonWorkaround is true if the workaround for
-// golang.org/issue/42515 is needed on NetBSD.
-var needSysmonWorkaround bool = false
-
// haveSysmon indicates whether there is sysmon thread support.
//
// No threads on wasm yet, so no sysmon.
netpollAdjustWaiters(delta)
}
}
- if GOOS == "netbsd" && needSysmonWorkaround {
- // netpoll is responsible for waiting for timer
- // expiration, so we typically don't have to worry
- // about starting an M to service timers. (Note that
- // sleep for timeSleepUntil above simply ensures sysmon
- // starts running again when that timer expiration may
- // cause Go code to run again).
- //
- // However, netbsd has a kernel bug that sometimes
- // misses netpollBreak wake-ups, which can lead to
- // unbounded delays servicing timers. If we detect this
- // overrun, then startm to get something to handle the
- // timer.
- //
- // See issue 42515 and
- // https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=50094.
- if next := timeSleepUntil(); next < now {
- startm(nil, false, false)
- }
- }
// Check if we need to update GOMAXPROCS at most once per second.
if debug.updatemaxprocs != 0 && lastgomaxprocs+1e9 <= now {
sysmonUpdateGOMAXPROCS()