]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: remove unused darwinVersion and getDarwinVersion
authorTobias Klauser <tklauser@distanz.ch>
Thu, 7 Jun 2018 10:17:40 +0000 (12:17 +0200)
committerTobias Klauser <tobias.klauser@gmail.com>
Thu, 7 Jun 2018 13:42:50 +0000 (13:42 +0000)
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: Brad Fitzpatrick <bradfitz@golang.org>
src/runtime/os_darwin.go

index 52153055f042bb0b87e8862dcbcff46ba09e8311..55f938cd800999fb548b7b4dfa864a5cd1ca592d 100644 (file)
@@ -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}