sys

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const OOMScoreMaxKillable = -999

OOMScoreMaxKillable is the maximum score keeping the process killable by the oom killer

Variables

This section is empty.

Functions

func CreateUnixSocket

func CreateUnixSocket(path string) (net.Listener, error)

CreateUnixSocket creates a unix socket and returns the listener

func EpollCreate1

func EpollCreate1(flag int) (int, error)

EpollCreate1 directly calls unix.EpollCreate1

func EpollCtl

func EpollCtl(epfd int, op int, fd int, event *unix.EpollEvent) error

EpollCtl directly calls unix.EpollCtl

func EpollWait

func EpollWait(epfd int, events []unix.EpollEvent, msec int) (int, error)

EpollWait directly calls unix.EpollWait

func FMountat added in v1.1.4

func FMountat(dirfd uintptr, source, target, fstype string, flags uintptr, data string) error

FMountat performs mount from the provided directory.

func ForceRemoveAll

func ForceRemoveAll(path string) error

ForceRemoveAll on unix is just a wrapper for os.RemoveAll

func GetLocalListener

func GetLocalListener(path string, uid, gid int) (net.Listener, error)

GetLocalListener returns a listener out of a unix socket.

func GetOpenFds

func GetOpenFds(pid int) (int, error)

GetOpenFds returns the number of open fds for the process provided by pid

func GetSubreaper added in v1.2.0

func GetSubreaper() (int, error)

GetSubreaper returns the subreaper setting for the calling process

func GetSystemCPUUsage

func GetSystemCPUUsage() (uint64, error)

GetSystemCPUUsage returns the host system's cpu usage in nanoseconds. An error is returned if the format of the underlying file does not match.

Uses /proc/stat defined by POSIX. Looks for the cpu statistics line and then sums up the first seven fields provided. See `man 5 proc` for details on specific field information.

func RunningPrivileged added in v1.1.4

func RunningPrivileged() bool

RunningPrivileged returns true if the effective user ID of the calling process is 0

func RunningUnprivileged added in v1.1.4

func RunningUnprivileged() bool

RunningUnprivileged returns true if the effective user ID of the calling process is not 0

func SetOOMScore

func SetOOMScore(pid, score int) error

SetOOMScore sets the oom score for the provided pid

func SetSubreaper added in v1.2.0

func SetSubreaper(i int) error

SetSubreaper sets the value i as the subreaper setting for the calling process

func StatATimeAsTime

func StatATimeAsTime(st *syscall.Stat_t) time.Time

StatATimeAsTime returns st.Atim as a time.Time

func StatAtime

func StatAtime(st *syscall.Stat_t) syscall.Timespec

StatAtime returns the Atim

func StatCtime

func StatCtime(st *syscall.Stat_t) syscall.Timespec

StatCtime returns the Ctim

func StatMtime

func StatMtime(st *syscall.Stat_t) syscall.Timespec

StatMtime returns the Mtim

Types

type Exit

type Exit struct {
	Pid    int
	Status int
}

Exit is the wait4 information from an exited process

func Reap

func Reap(wait bool) (exits []Exit, err error)

Reap reaps all child processes for the calling process and returns their exit information

Jump to

Keyboard shortcuts

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