You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-library/vendor/github.com/tklauser/go-sysconf
李光春 1099e35ff9
- update vendor
9 months ago
..
.cirrus.yml - update vendor 9 months ago
.gitignore - update vendor 1 year ago
LICENSE - update vendor 1 year ago
README.md - update vendor 1 year ago
sysconf.go - update vendor 1 year ago
sysconf_bsd.go - update vendor 1 year ago
sysconf_darwin.go - update vendor 9 months ago
sysconf_dragonfly.go - update vendor 1 year ago
sysconf_freebsd.go - update vendor 1 year ago
sysconf_generic.go - update vendor 1 year ago
sysconf_linux.go - update vendor 1 year ago
sysconf_netbsd.go - update vendor 1 year ago
sysconf_openbsd.go - update vendor 1 year ago
sysconf_posix.go - update vendor 1 year ago
sysconf_solaris.go - update vendor 1 year ago
sysconf_unsupported.go - update vendor 1 year ago
zsysconf_defs_darwin.go - update vendor 9 months ago
zsysconf_defs_dragonfly.go - update vendor 1 year ago
zsysconf_defs_freebsd.go - update vendor 1 year ago
zsysconf_defs_linux.go - update vendor 1 year ago
zsysconf_defs_netbsd.go - update vendor 1 year ago
zsysconf_defs_openbsd.go - update vendor 1 year ago
zsysconf_defs_solaris.go - update vendor 1 year ago
zsysconf_values_freebsd_386.go - update vendor 1 year ago
zsysconf_values_freebsd_amd64.go - update vendor 1 year ago
zsysconf_values_freebsd_arm.go - update vendor 1 year ago
zsysconf_values_freebsd_arm64.go - update vendor 1 year ago
zsysconf_values_freebsd_riscv64.go - update vendor 1 year ago
zsysconf_values_linux_386.go - update vendor 1 year ago
zsysconf_values_linux_amd64.go - update vendor 1 year ago
zsysconf_values_linux_arm.go - update vendor 1 year ago
zsysconf_values_linux_arm64.go - update vendor 1 year ago
zsysconf_values_linux_loong64.go - update vendor 1 year ago
zsysconf_values_linux_mips.go - update vendor 1 year ago
zsysconf_values_linux_mips64.go - update vendor 1 year ago
zsysconf_values_linux_mips64le.go - update vendor 1 year ago
zsysconf_values_linux_mipsle.go - update vendor 1 year ago
zsysconf_values_linux_ppc64.go - update vendor 1 year ago
zsysconf_values_linux_ppc64le.go - update vendor 1 year ago
zsysconf_values_linux_riscv64.go - update vendor 1 year ago
zsysconf_values_linux_s390x.go - update vendor 1 year ago
zsysconf_values_netbsd_386.go - update vendor 1 year ago
zsysconf_values_netbsd_amd64.go - update vendor 1 year ago
zsysconf_values_netbsd_arm.go - update vendor 1 year ago
zsysconf_values_netbsd_arm64.go - update vendor 1 year ago

README.md

go-sysconf

Go Reference GitHub Action Status

sysconf for Go, without using cgo or external binaries (e.g. getconf).

Supported operating systems: Linux, macOS, DragonflyBSD, FreeBSD, NetBSD, OpenBSD, Solaris/Illumos.

All POSIX.1 and POSIX.2 variables are supported, see References for a complete list.

Additionally, the following non-standard variables are supported on some operating systems:

Variable Supported on
SC_PHYS_PAGES Linux, macOS, FreeBSD, NetBSD, OpenBSD, Solaris/Illumos
SC_AVPHYS_PAGES Linux, OpenBSD, Solaris/Illumos
SC_NPROCESSORS_CONF Linux, macOS, FreeBSD, NetBSD, OpenBSD, Solaris/Illumos
SC_NPROCESSORS_ONLN Linux, macOS, FreeBSD, NetBSD, OpenBSD, Solaris/Illumos
SC_UIO_MAXIOV Linux

Usage

package main

import (
	"fmt"

	"github.com/tklauser/go-sysconf"
)

func main() {
	// get clock ticks, this will return the same as C.sysconf(C._SC_CLK_TCK)
	clktck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK)
	if err == nil {
		fmt.Printf("SC_CLK_TCK: %v\n", clktck)
	}
}

References