Documentation ¶
Index ¶
Constants ¶
View Source
const (
Wildcard = -1
)
Variables ¶
View Source
var ( DefaultSimpleDevices = []*Device{ { Path: "/dev/null", Type: 'c', MajorNumber: 1, MinorNumber: 3, CgroupPermissions: "rwm", FileMode: 0666, }, { Path: "/dev/zero", Type: 'c', MajorNumber: 1, MinorNumber: 5, CgroupPermissions: "rwm", FileMode: 0666, }, { Path: "/dev/full", Type: 'c', MajorNumber: 1, MinorNumber: 7, CgroupPermissions: "rwm", FileMode: 0666, }, { Path: "/dev/tty", Type: 'c', MajorNumber: 5, MinorNumber: 0, CgroupPermissions: "rwm", FileMode: 0666, }, { Path: "/dev/urandom", Type: 'c', MajorNumber: 1, MinorNumber: 9, CgroupPermissions: "rwm", FileMode: 0666, }, { Path: "/dev/random", Type: 'c', MajorNumber: 1, MinorNumber: 8, CgroupPermissions: "rwm", FileMode: 0666, }, } DefaultAllowedDevices = append([]*Device{ { Type: 'c', MajorNumber: Wildcard, MinorNumber: Wildcard, CgroupPermissions: "m", }, { Type: 'b', MajorNumber: Wildcard, MinorNumber: Wildcard, CgroupPermissions: "m", }, { Path: "/dev/console", Type: 'c', MajorNumber: 5, MinorNumber: 1, CgroupPermissions: "rwm", }, { Path: "/dev/tty0", Type: 'c', MajorNumber: 4, MinorNumber: 0, CgroupPermissions: "rwm", }, { Path: "/dev/tty1", Type: 'c', MajorNumber: 4, MinorNumber: 1, CgroupPermissions: "rwm", }, { Path: "", Type: 'c', MajorNumber: 136, MinorNumber: Wildcard, CgroupPermissions: "rwm", }, { Path: "", Type: 'c', MajorNumber: 5, MinorNumber: 2, CgroupPermissions: "rwm", }, { Path: "", Type: 'c', MajorNumber: 10, MinorNumber: 200, CgroupPermissions: "rwm", }, }, DefaultSimpleDevices...) DefaultAutoCreatedDevices = append([]*Device{ { Path: "/dev/fuse", Type: 'c', MajorNumber: 10, MinorNumber: 229, CgroupPermissions: "rwm", }, }, DefaultSimpleDevices...) )
View Source
var (
ErrNotADeviceNode = errors.New("not a device node")
)
Functions ¶
func GetDeviceNumberString ¶
Types ¶
type Device ¶
type Device struct { Type rune `json:"type,omitempty"` Path string `json:"path,omitempty"` // It is fine if this is an empty string in the case that you are using Wildcards MajorNumber int64 `json:"major_number,omitempty"` // Use the wildcard constant for wildcards. MinorNumber int64 `json:"minor_number,omitempty"` // Use the wildcard constant for wildcards. CgroupPermissions string `json:"cgroup_permissions,omitempty"` // Typically just "rwm" FileMode os.FileMode `json:"file_mode,omitempty"` // The permission bits of the file's mode }
func GetDevice ¶
Given the path to a device and it's cgroup_permissions(which cannot be easilly queried) look up the information about a linux device and return that information as a Device struct.
func GetHostDeviceNodes ¶
func (*Device) GetCgroupAllowString ¶
Click to show internal directories.
Click to hide internal directories.