...

Source file src/github.com/tklauser/go-sysconf/sysconf_bsd.go

Documentation: github.com/tklauser/go-sysconf

     1  // Copyright 2018 Tobias Klauser. 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  //go:build darwin || dragonfly || freebsd || netbsd || openbsd
     6  // +build darwin dragonfly freebsd netbsd openbsd
     7  
     8  package sysconf
     9  
    10  import "golang.org/x/sys/unix"
    11  
    12  func pathconf(path string, name int) int64 {
    13  	if val, err := unix.Pathconf(path, name); err == nil {
    14  		return int64(val)
    15  	}
    16  	return -1
    17  }
    18  
    19  func sysctl32(name string) int64 {
    20  	if val, err := unix.SysctlUint32(name); err == nil {
    21  		return int64(val)
    22  	}
    23  	return -1
    24  }
    25  
    26  func sysctl64(name string) int64 {
    27  	if val, err := unix.SysctlUint64(name); err == nil {
    28  		return int64(val)
    29  	}
    30  	return -1
    31  }
    32  
    33  func yesno(val int64) int64 {
    34  	if val == 0 {
    35  		return -1
    36  	}
    37  	return val
    38  }
    39  

View as plain text