cgroup

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

* Copyright (c) 2022, HabanaLabs Ltd. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttachCgroupDeviceFilter

func AttachCgroupDeviceFilter(prog *ebpf.Program, dirFd int) error

AttachCgroupDeviceFilter attaches a new device filter ebpf program to a cgroup.

func CGroupVersion

func CGroupVersion(rootPath string, pid int) (int, error)

TODO: not sure yet the meaning of rootPath since proc is under / CGroupVersion returns the verions of linux cgroup in use for the process

func DetachCgroupDeviceFilter

func DetachCgroupDeviceFilter(prog *ebpf.Program, dirFd int) error

DetachCgroupDeviceFilter detaches an existing device filter ebpf program from a cgroup.

func FindAttachedCgroupDeviceFilters

func FindAttachedCgroupDeviceFilters(dirFd int) ([]*ebpf.Program, error)

FindAttachedCgroupDeviceFilters finds all ebpf prgrams associated with 'dirFd' that control device access

func PrependDeviceFilter

func PrependDeviceFilter(devices []specs.LinuxDeviceCgroup, origInsts asm.Instructions) (asm.Instructions, error)

PrependDeviceFilter prepends a set of instructions for further device filtering to an existing device filtering ebpf program

Types

type DeviceRule

type DeviceRule = specs.LinuxDeviceCgroup

type Handler

type Handler interface {
	DeviceCGroupMountPath(procRootPath string, pid int) (string, string, error)
	DeviceCGroupRootPath(procRootPath string, prefix string, pid int) (string, error)
	AddDeviceRules(cgroupPath string, devices []DeviceRule) error
	SetLogger(logger *log.Logger)
}

func New

func New(version int) (Handler, error)

Jump to

Keyboard shortcuts

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