sys

package
v0.0.0-...-43a96cf Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 8 Imported by: 8

Documentation

Overview

Package platform encapsulates platform-specific behavior. Only put generic code in this file, per-platform code should go in the appropriately named per-platform files in this directory.

Index

Constants

View Source
const DefaultDirPerms = 0700

DefaultDirPerms is our default creation mode for directories. By default we only allow the user to operate on the directory.

View Source
const DefaultFilePerms = 0600

DefaultFilePerms is our default creation mode for files. By default we only allow the user to operate on a file.

View Source
const HabDefaultDataDirPerms = 0770

HabDefaultDataDirPerms is the mode used by habitat for data directories. We're using it when precreating them.

Variables

This section is empty.

Functions

func AllMounts

func AllMounts() ([]string, error)

AllMounts returns a slice of the mounted paths (strings) on the machine. It parse /proc/mounts, currently extracting the "mntonname" only.

func DirSize

func DirSize(path string) (int64, error)

DirSize return size of the directory in bytes path.

func MountFor

func MountFor(path string) (string, error)

MountFor returns the closest match in the mount table for the given path.

func SetUmask

func SetUmask(newUmask int) int

SetUmask sets the process umask. Returns the old umask.

func SpaceAvailForPath

func SpaceAvailForPath(path string) (uint64, error)

SpaceAvailForPath returns the space in KB available for the given path.

func SysProcAttrWithCred

func SysProcAttrWithCred(uid uint32, gid uint32) *syscall.SysProcAttr

SysProcAttrWithCred returns a SysProcAttr with the credentials set to the given uid and gid

func SystemMemoryKB

func SystemMemoryKB() (int, error)

SystemMemoryKB returns the total system memory in KB

Types

This section is empty.

Jump to

Keyboard shortcuts

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