From b3dd67316f0f69ae8abbc8fdcc552234ee07e993 Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Sat, 30 Apr 2016 14:13:26 +0200 Subject: [PATCH] lua: Do not try to detach buffers as kprobes --- src/lua/bcc/bpf.lua | 3 ++- src/lua/bcc/table.lua | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lua/bcc/bpf.lua b/src/lua/bcc/bpf.lua index 6472672..e76e608 100644 --- a/src/lua/bcc/bpf.lua +++ b/src/lua/bcc/bpf.lua @@ -41,7 +41,8 @@ function Bpf.static.cleanup_probes() local function detach_all(probe_type, all_probes) for key, probe in pairs(all_probes) do libbcc.perf_reader_free(probe) - if type(key) == "string" then + -- skip bcc-specific kprobes + if not key:starts("bcc:") then local desc = string.format("-:%s/%s", probe_type, key) log.info("detaching %s", desc) diff --git a/src/lua/bcc/table.lua b/src/lua/bcc/table.lua index 33f1cb1..af269d8 100644 --- a/src/lua/bcc/table.lua +++ b/src/lua/bcc/table.lua @@ -236,7 +236,7 @@ function PerfEventArray:initialize(bpf, map_id, map_fd, key_type, leaf_type) end local function _perf_id(id, cpu) - return string.format("perf_event_array:%d:%d", tonumber(id), cpu or 0) + return string.format("bcc:perf_event_array:%d:%d", tonumber(id), cpu or 0) end function PerfEventArray:_open_perf_buffer(cpu, callback, ctype) -- 2.7.4