osutil

package
v1.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2025 License: Apache-2.0 Imports: 21 Imported by: 11

Documentation

Index

Constants

View Source
const SigInt = Signal(syscall.SIGINT)

SigInt is the value of SIGINT.

View Source
const SigKill = Signal(syscall.SIGKILL)

SigKill is the value of SIGKILL.

View Source
const UnixPathMax = 108

UnixPathMax is the value of UNIX_PATH_MAX.

Variables

View Source
var MachineID = sync.OnceValue(func() string {
	x, err := machineID()
	if err == nil && x != "" {
		return x
	}
	logrus.WithError(err).Debug("failed to get machine ID, falling back to use hostname instead")
	hostname, err := os.Hostname()
	if err != nil {
		panic(fmt.Errorf("failed to get hostname: %w", err))
	}
	return hostname
})

Functions

func DNSAddresses added in v0.6.3

func DNSAddresses() ([]string, error)

func Dup2 added in v0.20.0

func Dup2(oldfd, newfd int) (err error)

func IsBeingRosettaTranslated added in v0.15.0

func IsBeingRosettaTranslated() bool

func LimaUser added in v0.6.4

func LimaUser(limaVersion string, warn bool) *user.User

func ProductVersion added in v0.19.0

func ProductVersion() (*semver.Version, error)

ProductVersion returns the OS product version, not the kernel version.

func ProxySettings added in v0.7.0

func ProxySettings() (map[string]string, error)

func SignalName added in v0.20.0

func SignalName(sig os.Signal) string

func SysKill added in v0.11.2

func SysKill(pid int, sig Signal) error

func Sysctl added in v1.0.3

func Sysctl(name string) (string, error)

Types

type Group added in v0.7.0

type Group struct {
	Name string
	Gid  uint32
}

func LookupGroup added in v0.7.0

func LookupGroup(name string) (Group, error)

type Signal added in v0.11.2

type Signal syscall.Signal

type Stat added in v0.11.2

type Stat struct {
	Uid uint32
	Gid uint32
}

Stat is a selection of syscall.Stat_t.

func SysStat added in v0.11.2

func SysStat(fi fs.FileInfo) (Stat, bool)

type User added in v0.7.0

type User struct {
	User  string
	Uid   uint32
	Group string
	Gid   uint32
	Name  string // or Comment
	Home  string
}

func LookupUser added in v0.7.0

func LookupUser(name string) (User, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL