Commit e6b7c740 authored by Vicent Marti's avatar Vicent Marti

bpf.lua: Implement `load_funcs`

parent e7893607
......@@ -129,6 +129,20 @@ function Bpf:initialize(args)
assert(self.module ~= nil, "failed to compile BPF module")
end
function Bpf:load_funcs(prog_type)
prog_type = prog_type or "BPF_PROG_TYPE_KPROBE"
local result = {}
local fn_count = tonumber(libbcc.bpf_num_functions(self.module))
for i = 0,fn_count-1 do
local name = ffi.string(libbcc.bpf_function_name(self.module, i))
table.insert(result, self:load_func(name, prog_type))
end
return result
end
function Bpf:load_func(fn_name, prog_type)
if self.funcs[fn_name] ~= nil then
return self.funcs[fn_name]
......
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