#bpf #bindings #bcc

bcc

Idiomatic Rust bindings for BPF Compiler Collection (BCC)

13 releases

✓ Uses Rust 2018 edition

0.0.13 Oct 7, 2019
0.0.12 Sep 16, 2019
0.0.10 Jul 8, 2019
0.0.9 May 22, 2019
0.0.3 Feb 8, 2018

#2 in #bpf

Download history 57/week @ 2019-06-24 42/week @ 2019-07-01 133/week @ 2019-07-08 7/week @ 2019-07-15 17/week @ 2019-07-22 11/week @ 2019-07-29 34/week @ 2019-08-05 1/week @ 2019-08-12 77/week @ 2019-08-19 73/week @ 2019-08-26 88/week @ 2019-09-02 80/week @ 2019-09-09 251/week @ 2019-09-16 61/week @ 2019-09-23 47/week @ 2019-09-30

290 downloads per month

MIT license

55KB
1.5K SLoC

rust-bcc

Idiomatic Rust bindings for the BPF compiler collection. The goal is to mimic the Python BCC bindings in https://github.com/iovisor/bcc in a Rusty way.

The C bcc API (as exposed in bcc-sys) is very powerful, but it's fairly nontrivial to try to use it by itself and manage all the resources it allocates safely.

This crate is currently experimental and has several things in it which are either unsafe or not particularly idiomatic for Rust. Pull requests very much appreciated.

Prerequisites

  • bcc v0.4.0-v0.10.0

Getting Started

The best way to learn about how to use this crate right now is to read the examples. The exciting thing about these examples is that the Rust version isn't really more verbose than the Python version. In some ways the Rust code is more legible because it's much more natural to work with C data structure in Rust than it is in Python.

Building

This library uses features to allow support for multiple versions of bcc. Depending on what version of bcc you have installed, you may need to use a feature flag while building the examples in-order to match the expected version of bcc with the version you have installed on your system.

Examples

Dependencies

~3MB
~83K SLoC