Documentation ¶
Index ¶
- Constants
- func GetHostByteOrder() binary.ByteOrder
- func GetSyscallFnName(name string) string
- func GetSyscallPrefix() string
- type Module
- func (bpf *Module) AttachKprobe(fnName string, fd int, maxActive int) error
- func (bpf *Module) AttachKretprobe(fnName string, fd int, maxActive int) error
- func (bpf *Module) AttachMatchingUprobes(name, match string, fd, pid int) error
- func (bpf *Module) AttachMatchingUretprobes(name, match string, fd, pid int) error
- func (bpf *Module) AttachPerfEvent(evType, evConfig int, samplePeriod int, sampleFreq int, ...) error
- func (bpf *Module) AttachRawTracepoint(name string, fd int) error
- func (bpf *Module) AttachTracepoint(name string, fd int) error
- func (bpf *Module) AttachUprobe(name, symbol string, fd, pid int) error
- func (bpf *Module) AttachUretprobe(name, symbol string, fd, pid int) error
- func (bpf *Module) AttachXDP(devName string, fd int) error
- func (bpf *Module) AttachXDPWithFlags(devName string, fd int, flags uint32) error
- func (bpf *Module) Close()
- func (bpf *Module) GetProgramTag(fd int) (tag uint64, err error)
- func (bpf *Module) Load(name string, progType int, logLevel, logSize uint) (int, error)
- func (bpf *Module) LoadKprobe(name string) (int, error)
- func (bpf *Module) LoadNet(name string) (int, error)
- func (bpf *Module) LoadPerfEvent(name string) (int, error)
- func (bpf *Module) LoadRawTracepoint(name string) (int, error)
- func (bpf *Module) LoadTracepoint(name string) (int, error)
- func (bpf *Module) LoadUprobe(name string) (int, error)
- func (bpf *Module) RemoveXDP(devName string) error
- func (bpf *Module) TableDesc(id uint64) map[string]interface{}
- func (bpf *Module) TableId(name string) C.size_t
- func (bpf *Module) TableIter() <-chan map[string]interface{}
- func (bpf *Module) TableSize() uint64
- type PerfMap
- type Table
- func (table *Table) Config() map[string]interface{}
- func (table *Table) Delete(key []byte) error
- func (table *Table) DeleteAll() error
- func (table *Table) DeleteP(key unsafe.Pointer) error
- func (table *Table) Get(key []byte) ([]byte, error)
- func (table *Table) GetP(key unsafe.Pointer) (unsafe.Pointer, error)
- func (table *Table) ID() string
- func (table *Table) Iter() *TableIterator
- func (table *Table) KeyBytesToStr(key []byte) (string, error)
- func (table *Table) KeyStrToBytes(keyStr string) ([]byte, error)
- func (table *Table) LeafBytesToStr(leaf []byte) (string, error)
- func (table *Table) LeafStrToBytes(leafStr string) ([]byte, error)
- func (table *Table) Name() string
- func (table *Table) Set(key, leaf []byte) error
- func (table *Table) SetP(key, leaf unsafe.Pointer) error
- type TableIterator
Constants ¶
const ( BPF_PROBE_ENTRY = iota BPF_PROBE_RETURN )
const ( XDP_FLAGS_UPDATE_IF_NOEXIST = uint32(1) << iota XDP_FLAGS_SKB_MODE XDP_FLAGS_DRV_MODE XDP_FLAGS_HW_MODE XDP_FLAGS_MODES = XDP_FLAGS_SKB_MODE | XDP_FLAGS_DRV_MODE | XDP_FLAGS_HW_MODE XDP_FLAGS_MASK = XDP_FLAGS_UPDATE_IF_NOEXIST | XDP_FLAGS_MODES )
const BPF_PERF_READER_PAGE_CNT = 8
BPF_PERF_READER_PAGE_CNT is the default page_cnt used per cpu ring buffer
Variables ¶
This section is empty.
Functions ¶
func GetHostByteOrder ¶
GetHostByteOrder returns the current byte-order.
func GetSyscallFnName ¶
func GetSyscallPrefix ¶
func GetSyscallPrefix() string
Types ¶
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module type
func NewModule ¶
NewModule asynchronously compiles the code, generates a new BPF module and returns it.
func (*Module) AttachKprobe ¶
AttachKprobe attaches a kprobe fd to a function.
func (*Module) AttachKretprobe ¶
AttachKretprobe attaches a kretprobe fd to a function.
func (*Module) AttachMatchingUprobes ¶
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 ¶
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) AttachPerfEvent ¶
func (bpf *Module) AttachPerfEvent(evType, evConfig int, samplePeriod int, sampleFreq int, pid, cpu, groupFd, fd int) error
AttachPerfEvent attaches a perf event fd to a function Argument 'evType' is a member of 'perf_type_id' enum in the kernel header 'include/uapi/linux/perf_event.h'. Argument 'evConfig' is one of PERF_COUNT_* constants in the same file.
func (*Module) AttachRawTracepoint ¶
AttachRawTracepoint attaches a raw tracepoint fd to a function The 'name' argument is in the format 'name', there is no category
func (*Module) AttachTracepoint ¶
AttachTracepoint attaches a tracepoint fd to a function The 'name' argument is in the format 'category:name'
func (*Module) AttachUprobe ¶
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 ¶
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) AttachXDPWithFlags ¶
AttachXDPWithFlags attaches a xdp fd to a device with flags.
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) GetProgramTag ¶
GetProgramTag returns a tag for ebpf program under passed fd
func (*Module) LoadKprobe ¶
LoadKprobe loads a program of type BPF_PROG_TYPE_KPROBE.
func (*Module) LoadPerfEvent ¶
LoadPerfEvent loads a program of type BPF_PROG_TYPE_PERF_EVENT
func (*Module) LoadRawTracepoint ¶
LoadRawTracepoint loads a program of type BPF_PROG_TYPE_RAW_TRACEPOINT
func (*Module) LoadTracepoint ¶
LoadTracepoint loads a program of type BPF_PROG_TYPE_TRACEPOINT
func (*Module) LoadUprobe ¶
LoadUprobe loads a program of type BPF_PROG_TYPE_KPROBE.
type PerfMap ¶
type PerfMap struct {
// contains filtered or unexported fields
}
func InitPerfMap ¶
InitPerfMap initializes a perf map with a receiver channel, with a default page_cnt.
func InitPerfMapWithPageCnt ¶
func InitPerfMapWithPageCnt(table *Table, receiverChan chan []byte, lostChan chan uint64, pageCnt int) (*PerfMap, error)
InitPerfMapWithPageCnt initializes a perf map with a receiver channel with a specified page_cnt.
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table references a BPF table. The zero value cannot be used.
func (*Table) Iter ¶
func (table *Table) Iter() *TableIterator
Iter returns an iterator to list all table entries available as raw bytes.
func (*Table) KeyBytesToStr ¶
KeyBytesToStr returns the given key value formatted using the bcc-table's key string printer.
func (*Table) LeafBytesToStr ¶
LeafBytesToStr returns the given leaf value formatted using the bcc-table's leaf string printer.
type TableIterator ¶
type TableIterator struct {
// contains filtered or unexported fields
}
TableIterator contains the current position for iteration over a *bcc.Table and provides methods for iteration.
func (*TableIterator) Err ¶
func (it *TableIterator) Err() error
Err returns the last error that ocurred while table.Iter oder iter.Next
func (*TableIterator) Key ¶
func (it *TableIterator) Key() []byte
Key returns the current key value of the iterator, if the most recent call to Next returned true. The slice is valid only until the next call to Next.
func (*TableIterator) Leaf ¶
func (it *TableIterator) Leaf() []byte
Leaf returns the current leaf value of the iterator, if the most recent call to Next returned true. The slice is valid only until the next call to Next.
func (*TableIterator) Next ¶
func (it *TableIterator) Next() bool
Next looks up the next element and return true if one is available.