cap

package
v1.4.0-k3s.7 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package cap provides Linux capability utility

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Current

func Current() ([]string, error)

Current returns the list of the effective and the known caps of the current process.

The result is like []string{"CAP_SYS_ADMIN", ...}.

The result does not contain caps that are not recognized by the "github.com/syndtr/gocapability" library.

func FromBitmap

func FromBitmap(v uint64) ([]string, []int)

FromBitmap parses an uint64 bitmap into string slice like []{"CAP_SYS_ADMIN", ...}.

Unknown cap numbers are returned as []int.

func FromNumber

func FromNumber(num int) string

FromNumber returns a cap string like "CAP_SYS_ADMIN" that corresponds to the given number like 21.

FromNumber returns an empty string for unknown cap number.

func Known

func Known() []string

Known returns the known cap strings of the latest kernel. The current latest kernel is 5.9.

func ParseProcPIDStatus

func ParseProcPIDStatus(r io.Reader) (map[Type]uint64, error)

ParseProcPIDStatus returns uint64 bitmap value from /proc/<PID>/status file

Types

type Type

type Type int

Type is the type of capability

const (
	// Effective is CapEff
	Effective Type = 1 << iota
	// Permitted is CapPrm
	Permitted
	// Inheritable is CapInh
	Inheritable
	// Bounding is CapBnd
	Bounding
	// Ambient is CapAmb
	Ambient
)

Jump to

Keyboard shortcuts

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