File: example_test.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 (30 lines) | stat: -rw-r--r-- 720 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
// 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 || linux || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux netbsd openbsd solaris

package sysconf_test

import (
	"fmt"
	"os"

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

func ExampleSysconf_clktck() {
	clktck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Sysconf: %v\n", err)
	}
	fmt.Printf("sysconf(SC_CLK_TCK) = %v\n", clktck)
}

func ExampleSysconf_invalidParameter() {
	_, err := sysconf.Sysconf(-1)
	fmt.Print(err)

	// Output: invalid parameter value
}