github.com/binkynet/BinkyNet@v1.12.1-0.20240421190447-da4e34c20be0/proto_vendor/golang.org/x/net/internal/socket/sys_dragonfly.go (about)

     1  // Copyright 2017 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package socket
     6  
     7  import (
     8  	"sync"
     9  	"syscall"
    10  	"unsafe"
    11  )
    12  
    13  // See version list in https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/sys/param.h
    14  var (
    15  	osreldateOnce sync.Once
    16  	osreldate     uint32
    17  )
    18  
    19  // First __DragonFly_version after September 2019 ABI changes
    20  // http://lists.dragonflybsd.org/pipermail/users/2019-September/358280.html
    21  const _dragonflyABIChangeVersion = 500705
    22  
    23  func probeProtocolStack() int {
    24  	osreldateOnce.Do(func() { osreldate, _ = syscall.SysctlUint32("kern.osreldate") })
    25  	var p uintptr
    26  	if int(unsafe.Sizeof(p)) == 8 && osreldate >= _dragonflyABIChangeVersion {
    27  		return int(unsafe.Sizeof(p))
    28  	}
    29  	// 64-bit Dragonfly before the September 2019 ABI changes still requires
    30  	// 32-bit aligned access to network subsystem.
    31  	return 4
    32  }