bcc

package
v0.0.0-...-b7469eb Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BPF_PROBE_ENTRY = iota
	BPF_PROBE_RETURN
)
View Source
const BPF_PERF_READER_PAGE_CNT = 8

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Key   string
	Value string
}

Entry represents a table entry.

type Module

type Module struct {
	// contains filtered or unexported fields
}

Module type

func NewModule

func NewModule(code string, cflags []string) *Module

NewModule asynchronously compiles the code, generates a new BPF module and returns it.

func (*Module) AttachKprobe

func (bpf *Module) AttachKprobe(fnName string, fd int) error

AttachKprobe attaches a kprobe fd to a function.

func (*Module) AttachKretprobe

func (bpf *Module) AttachKretprobe(fnName string, fd int) error

AttachKretprobe attaches a kretprobe fd to a function.

func (*Module) AttachMatchingUprobes

func (bpf *Module) AttachMatchingUprobes(name, match string, fd, pid int) error

AttachMatchingUprobes attaches a uprobe fd to all symbols in the library or binary 'name' that match a given pattern. The 'name' argument can be given as either a full library path (/usr/lib/..), a library without the lib prefix, or as a binary with full path (/bin/bash) A pid can be given, or -1 to attach to all processes

Presently attempts to trace processes running in a different namespace to the tracer will fail due to limitations around namespace-switching in multi-threaded programs (such as Go programs)

func (*Module) AttachMatchingUretprobes

func (bpf *Module) AttachMatchingUretprobes(name, match string, fd, pid int) error

AttachMatchingUretprobes attaches a uretprobe fd to all symbols in the library or binary 'name' that match a given pattern. The 'name' argument can be given as either a full library path (/usr/lib/..), a library without the lib prefix, or as a binary with full path (/bin/bash) A pid can be given, or -1 to attach to all processes

Presently attempts to trace processes running in a different namespace to the tracer will fail due to limitations around namespace-switching in multi-threaded programs (such as Go programs)

func (*Module) AttachUprobe

func (bpf *Module) AttachUprobe(name, symbol string, fd, pid int) error

AttachUprobe attaches a uprobe fd to the symbol in the library or binary 'name' The 'name' argument can be given as either a full library path (/usr/lib/..), a library without the lib prefix, or as a binary with full path (/bin/bash) A pid can be given to attach to, or -1 to attach to all processes

Presently attempts to trace processes running in a different namespace to the tracer will fail due to limitations around namespace-switching in multi-threaded programs (such as Go programs)

func (*Module) AttachUretprobe

func (bpf *Module) AttachUretprobe(name, symbol string, fd, pid int) error

AttachUretprobe attaches a uretprobe fd to the symbol in the library or binary 'name' The 'name' argument can be given as either a full library path (/usr/lib/..), a library without the lib prefix, or as a binary with full path (/bin/bash) A pid can be given to attach to, or -1 to attach to all processes

Presently attempts to trace processes running in a different namespace to the tracer will fail due to limitations around namespace-switching in multi-threaded programs (such as Go programs)

func (*Module) AttachXDP

func (bpf *Module) AttachXDP(devName string, fd int) error

AttachXDP attaches a xdp fd to a device.

func (*Module) Close

func (bpf *Module) Close()

Close takes care of closing all kprobes opened by this modules and destroys the underlying libbpf module.

func (*Module) Load

func (bpf *Module) Load(name string, progType int) (int, error)

Load a program.

func (*Module) LoadKprobe

func (bpf *Module) LoadKprobe(name string) (int, error)

LoadKprobe loads a program of type BPF_PROG_TYPE_KPROBE.

func (*Module) LoadNet

func (bpf *Module) LoadNet(name string) (int, error)

LoadNet loads a program of type BPF_PROG_TYPE_SCHED_ACT.

func (*Module) LoadUprobe

func (bpf *Module) LoadUprobe(name string) (int, error)

LoadUprobe loads a program of type BPF_PROG_TYPE_KPROBE.

func (*Module) RemoveXDP

func (bpf *Module) RemoveXDP(devName string) error

RemoveXDP removes any xdp from this device.

func (*Module) TableDesc

func (bpf *Module) TableDesc(id uint64) map[string]interface{}

TableDesc returns a map with table properties (name, fd, ...).

func (*Module) TableId

func (bpf *Module) TableId(name string) C.size_t

TableId returns the id of a table.

func (*Module) TableIter

func (bpf *Module) TableIter() <-chan map[string]interface{}

TableIter returns a receveier channel to iterate over entries.

func (*Module) TableSize

func (bpf *Module) TableSize() uint64

TableSize returns the number of tables in the module.

type PerfMap

type PerfMap struct {
	// contains filtered or unexported fields
}

func InitPerfMap

func InitPerfMap(table *Table, receiverChan chan []byte) (*PerfMap, error)

InitPerfMap initializes a perf map with a receiver channel.

func (*PerfMap) Start

func (pm *PerfMap) Start()

Start to poll the perf map reader and send back event data over the connected channel.

func (*PerfMap) Stop

func (pm *PerfMap) Stop()

Stop to poll the perf map readers after a maximum of 500ms (the timeout we use for perf_reader_poll). Ideally we would have a way to cancel the poll, but perf_reader_poll doesn't support that yet.

type Table

type Table struct {
	// contains filtered or unexported fields
}

func NewTable

func NewTable(id C.size_t, module *Module) *Table

New tables returns a refernce to a BPF table.

func (*Table) Config

func (table *Table) Config() map[string]interface{}

Config returns the table properties (name, fd, ...).

func (*Table) Delete

func (table *Table) Delete(keyStr string) error

Delete a key.

func (*Table) DeleteRaw

func (table *Table) DeleteRaw(_key []byte) error

Delete a key.

func (*Table) Get

func (table *Table) Get(keyStr string) (interface{}, bool)

Get takes a key and returns the value or nil, and an 'ok' style indicator.

func (*Table) GetRaw

func (table *Table) GetRaw(_key []byte) ([]byte, bool)

func (*Table) ID

func (table *Table) ID() string

ID returns the table id.

func (*Table) Iter

func (table *Table) Iter() <-chan Entry

Iter returns a receiver channel to iterate over all table entries.

func (*Table) Name

func (table *Table) Name() string

Name returns the table name.

func (*Table) Set

func (table *Table) Set(keyStr, leafStr string) error

Set a key to a value.

func (*Table) SetRaw

func (table *Table) SetRaw(_key, _leaf []byte) error

Jump to

Keyboard shortcuts

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