From: Derek <“derek0883@gmail.com”> Date: Thu, 26 Jan 2017 02:01:16 +0000 (-0800) Subject: rename event_name for lua X-Git-Tag: v0.3.0~66^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1f356bac21a1218ec5b0fecdf30a4a2459aead81;p=platform%2Fupstream%2Fbcc.git rename event_name for lua --- diff --git a/src/lua/bcc/bpf.lua b/src/lua/bcc/bpf.lua index 8cda252..14f69bd 100644 --- a/src/lua/bcc/bpf.lua +++ b/src/lua/bcc/bpf.lua @@ -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) diff --git a/src/lua/bcc/libbcc.lua b/src/lua/bcc/libbcc.lua index d744a46..5680954 100644 --- a/src/lua/bcc/libbcc.lua +++ b/src/lua/bcc/libbcc.lua @@ -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); ]]