File: sysconf_bsd.go

package info (click to toggle)
golang-github-tklauser-go-sysconf 0.3.11-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid, trixie
  • size: 540 kB
  • sloc: makefile: 2
file content (38 lines) | stat: -rw-r--r-- 787 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2018 Tobias Klauser. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build darwin || dragonfly || freebsd || netbsd || openbsd
// +build darwin dragonfly freebsd netbsd openbsd

package sysconf

import "golang.org/x/sys/unix"

func pathconf(path string, name int) int64 {
	if val, err := unix.Pathconf(path, name); err == nil {
		return int64(val)
	}
	return -1
}

func sysctl32(name string) int64 {
	if val, err := unix.SysctlUint32(name); err == nil {
		return int64(val)
	}
	return -1
}

func sysctl64(name string) int64 {
	if val, err := unix.SysctlUint64(name); err == nil {
		return int64(val)
	}
	return -1
}

func yesno(val int64) int64 {
	if val == 0 {
		return -1
	}
	return val
}