cap

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: Apache-2.0 Imports: 6 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

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", ...}.

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