Skip to content

Commit

Permalink
rename event_name for lua
Browse files Browse the repository at this point in the history
  • Loading branch information
Derek committed Jan 31, 2017
1 parent 35da3d0 commit 1f356ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/lua/bcc/bpf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/lua/bcc/libbcc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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);
]]
Expand Down

0 comments on commit 1f356ba

Please sign in to comment.