Commit 5f2b4f26 authored by Tobias Klauser's avatar Tobias Klauser Committed by Tobias Klauser

runtime: remove unused darwinVersion and getDarwinVersion

They are unused since CL 114799.

Also remove consts _CTL_KERN and _KERN_OSRELEASE previously used by
getDarwinVersion.

Change-Id: I51b701e8effbe4dd4301b0e6d52e8885469032f4
Reviewed-on: https://go-review.googlesource.com/116955
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent e5f0c1f6
......@@ -11,8 +11,6 @@ type mOS struct {
waitsema uint32 // semaphore for parking on locks
}
var darwinVersion int
//go:noescape
func mach_msg_trap(h unsafe.Pointer, op int32, send_size, rcv_size, rcv_name, timeout, notify uint32) int32
......@@ -50,34 +48,14 @@ func osinit() {
ncpu = getncpu()
physPageSize = getPageSize()
darwinVersion = getDarwinVersion()
}
const (
_CTL_KERN = 1
_CTL_HW = 6
_KERN_OSRELEASE = 2
_HW_NCPU = 3
_HW_PAGESIZE = 7
_CTL_HW = 6
_HW_NCPU = 3
_HW_PAGESIZE = 7
)
func getDarwinVersion() int {
// Use sysctl to fetch kern.osrelease
mib := [2]uint32{_CTL_KERN, _KERN_OSRELEASE}
var out [32]byte
nout := unsafe.Sizeof(out)
ret := sysctl(&mib[0], 2, (*byte)(unsafe.Pointer(&out)), &nout, nil, 0)
if ret >= 0 {
ver := 0
for i := 0; i < int(nout) && out[i] >= '0' && out[i] <= '9'; i++ {
ver *= 10
ver += int(out[i] - '0')
}
return ver
}
return 17 // should not happen: default to a newish version
}
func getncpu() int32 {
// Use sysctl to fetch hw.ncpu.
mib := [2]uint32{_CTL_HW, _HW_NCPU}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment