1 // Copyright 2014 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.
5 // +build darwin dragonfly freebsd openbsd
14 "golang.org/x/sys/unix"
20 func TestGetfsstat(t *testing.T) {
21 const flags = MNT_NOWAIT // see golang.org/issue/16937
22 n, err := unix.Getfsstat(nil, flags)
27 data := make([]unix.Statfs_t, n)
28 n2, err := unix.Getfsstat(data, flags)
33 t.Errorf("Getfsstat(nil) = %d, but subsequent Getfsstat(slice) = %d", n, n2)
35 for i, stat := range data {
36 if stat == (unix.Statfs_t{}) {
37 t.Errorf("index %v is an empty Statfs_t struct", i)
41 for i, stat := range data[:n2] {
42 t.Logf("data[%v] = %+v", i, stat)
44 mount, err := exec.Command("mount").CombinedOutput()
46 t.Logf("mount: %v\n%s", err, mount)
48 t.Logf("mount: %s", mount)
53 func TestSysctlRaw(t *testing.T) {
54 if runtime.GOOS == "openbsd" {
55 t.Skip("kern.proc.pid does not exist on OpenBSD")
58 _, err := unix.SysctlRaw("kern.proc.pid", unix.Getpid())