Commit 1888c167 authored by Derek's avatar Derek

rename event_name for lua

parent c2233534
......@@ -14,6 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
]]
local ffi = require("ffi")
ffi.cdef[[
int getpid(void);
]]
local libbcc = require("bcc.libbcc")
local TracerPipe = require("bcc.tracerpipe")
......@@ -47,9 +51,9 @@ function Bpf.static.cleanup()
log.info("detaching %s", desc)
if probe_type == "kprobes" then
libbcc.bpf_detach_kprobe(desc)
libbcc.bpf_detach_kprobe(desc, key)
elseif probe_type == "uprobes" then
libbcc.bpf_detach_uprobe(desc)
libbcc.bpf_detach_uprobe(desc, key)
end
end
all_probes[key] = nil
......@@ -209,6 +213,7 @@ function Bpf:attach_kprobe(args)
local event = args.event or ""
local ptype = args.retprobe and "r" or "p"
local ev_name = string.format("%s_%s", ptype, event:gsub("[%+%.]", "_"))
local ev_name = string.format("%s_bcc_%s", ev_name, ffi.C.getpid());
local desc = string.format("%s:kprobes/%s %s", ptype, ev_name, event)
log.info(desc)
......
......@@ -42,11 +42,11 @@ typedef void (*perf_reader_raw_cb)(void *cb_cookie, void *raw, int raw_size);
void * bpf_attach_kprobe(int progfd, const char *event, const char *event_desc,
int pid, int cpu, int group_fd, perf_reader_cb cb, void *cb_cookie);
int bpf_detach_kprobe(const char *event_desc);
int bpf_detach_kprobe(const char *event_desc, const char *event);
void * bpf_attach_uprobe(int progfd, const char *event, const char *event_desc,
int pid, int cpu, int group_fd, perf_reader_cb cb, void *cb_cookie);
int bpf_detach_uprobe(const char *event_desc);
int bpf_detach_uprobe(const char *event_desc, const char *event);
void * bpf_open_perf_buffer(perf_reader_raw_cb raw_cb, void *cb_cookie, int pid, int cpu);
]]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment