osutil

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2025 License: Apache-2.0 Imports: 22 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func DNSAddresses() ([]string, error)

func Dup2

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

func IsBeingRosettaTranslated

func IsBeingRosettaTranslated() bool

func LimaUser

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

func ProductVersion

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

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

func ProxySettings

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

func SignalName

func SignalName(sig os.Signal) string

func SysKill

func SysKill(pid int, sig Signal) error

func Sysctl

func Sysctl(name string) (string, error)

Types

type Group

type Group struct {
	Name string
	Gid  uint32
}

func LookupGroup

func LookupGroup(name string) (Group, error)

type Signal

type Signal syscall.Signal

type Stat

type Stat struct {
	Uid uint32
	Gid uint32
}

Stat is a selection of syscall.Stat_t.

func SysStat

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

type User

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

func LookupUser

func LookupUser(name string) (User, error)

Jump to

Keyboard shortcuts

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