Skip to content

Instantly share code, notes, and snippets.

@raffysommy
Created August 6, 2018 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raffysommy/587f61c14d3e157f86da1aadd07442b1 to your computer and use it in GitHub Desktop.
Save raffysommy/587f61c14d3e157f86da1aadd07442b1 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
#
from bcc import BPF
import time
# define BPF program
prog = """
#include <linux/sched.h>
#include <linux/bpf.h>
BPF_PERF_OUTPUT(events);
int kprobe__htab_map_update_elem() {
bpf_trace_printk("trace \\n");
return 0;
}
"""
# load BPF program
b = BPF(text=prog)
#b.attach_kprobe(event="htab_map_update_elem", fn_name="hello")
while 1:
time.sleep(10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment