mirror of
https://github.com/golang/sys.git
synced 2026-02-08 11:46:04 +03:00
OpenBSD uses sysctl with struct uvmexp to get information from the virtual memory system of the kernel. Add type Uvmexp and the SysctlUvmexp function to query this information. This will be used in github.com/tklauser/go-sysconf to get _SC_AVPHYS_PAGES on OpenBSD. Change-Id: I96ded2d1be37e5307bab55e79b13234cc93d21e6 Reviewed-on: https://go-review.googlesource.com/c/139278 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
20 lines
378 B
Go
20 lines
378 B
Go
// Copyright 2018 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.
|
|
|
|
package unix_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
func TestSysctlUvmexp(t *testing.T) {
|
|
uvm, err := unix.SysctlUvmexp("vm.uvmexp")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Logf("free = %v", uvm.Free)
|
|
}
|