unix: add custom Sysctl args and methods SysctlUint64, SysctlRaw

Add support for optional sysctl arguments which is required to support
sysctls that require more than the mib identifer args as returned from
nametomib such as kern.proc.pid.

Add SysctlUint64 which allows sysctls that return 64 bit ints to be
queried.

Add SysctlRaw which allows sysctls that return structs or other
unsupported types to be queried.

Change-Id: If0fa23935ee09496f2df210364d8988ccd0f3db6
Reviewed-on: https://go-review.googlesource.com/14955
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Steven Hartland
2015-10-29 18:30:43 +00:00
committed by Ian Lance Taylor
parent 354f231ae1
commit d9157a9621
3 changed files with 98 additions and 8 deletions
+7
View File
@@ -33,3 +33,10 @@ func TestGetfsstat(t *testing.T) {
}
}
}
func TestSysctlRaw(t *testing.T) {
_, err := unix.SysctlRaw("kern.proc.pid", unix.Getpid())
if err != nil {
t.Fatal(err)
}
}