|1 month ago|
|Documentation||2 years ago|
|bcc||2 months ago|
|elf||1 month ago|
|examples||5 months ago|
|pkg||10 months ago|
|tests||2 months ago|
|CONTRIBUTING.md||2 months ago|
|COPYRIGHT.txt||3 years ago|
|LICENSE-bpf.txt||2 years ago|
|LICENSE.txt||3 years ago|
|README.md||2 months ago|
|bpf.go||3 years ago|
|bpf_test.go||2 months ago|
|semaphore.sh||2 months ago|
This repository provides go bindings for the bcc framework as well as low-level routines to load and use eBPF programs from .elf files.
Input and contributions are very welcome.
We recommend vendoring gobpf and pinning its version as the API is regularly changing following bcc and Linux updates and releases.
eBPF requires a recent Linux kernel. A good feature list can be found here: https://github.com/iovisor/bcc/blob/master/docs/kernel-versions.md
Install the latest released version of libbcc (either using a package manager or by building from source).
To build ELF object files for use with the elf package, you must use specific
SEC("...")). The following are currently supported:
Map definitions must correspond to
bpf_map_def from the elf package.
Otherwise, you will encounter an error like
only one map with size 280 bytes allowed per section (check bpf_map_def).
tests/dummy.c for a minimal dummy and https://github.com/weaveworks/tcptracer-bpf
for a real world example.
Sample code can be found in the
examples/ directory. Examples can be run as
sudo -E go run examples/bcc/perf/perf.go
semaphore.sh script can be used to run the tests in rkt stage1-kvm
containers on different kernel versions. To run all tests on the host system,
go test as follows:
go test -tags integration -v ./...