1
0
mirror of https://github.com/Luzifer/cloudkeys-go.git synced 2024-09-19 23:52:57 +00:00
cloudkeys-go/vendor/golang.org/x/net/route/syscall.go
Knut Ahlers 99ff9846a3
Update vendoring using dep
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2017-12-29 23:13:47 +01:00

29 lines
729 B
Go

// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin dragonfly freebsd netbsd openbsd
package route
import (
"syscall"
"unsafe"
)
var zero uintptr
func sysctl(mib []int32, old *byte, oldlen *uintptr, new *byte, newlen uintptr) error {
var p unsafe.Pointer
if len(mib) > 0 {
p = unsafe.Pointer(&mib[0])
} else {
p = unsafe.Pointer(&zero)
}
_, _, errno := syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(p), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
if errno != 0 {
return error(errno)
}
return nil
}