diff options
author | Kumar Kartikeya Dwivedi <[email protected]> | 2022-11-18 07:26:04 +0530 |
---|---|---|
committer | Alexei Starovoitov <[email protected]> | 2022-11-17 19:22:14 -0800 |
commit | ac9f06050a3580cf4076a57a470cd71f12a81171 (patch) | |
tree | 7bd331dc4f348eb14778aa3b9062e3d028717625 /tools/perf/scripts/python/sctop.py | |
parent | 958cf2e273f0929c66169e0788031310e8118722 (diff) |
bpf: Introduce bpf_obj_drop
Introduce bpf_obj_drop, which is the kfunc used to free allocated
objects (allocated using bpf_obj_new). Pairing with bpf_obj_new, it
implicitly destructs the fields part of object automatically without
user intervention.
Just like the previous patch, btf_struct_meta that is needed to free up
the special fields is passed as a hidden argument to the kfunc.
For the user, a convenience macro hides over the kernel side kfunc which
is named bpf_obj_drop_impl.
Continuing the previous example:
void prog(void) {
struct foo *f;
f = bpf_obj_new(typeof(*f));
if (!f)
return;
bpf_obj_drop(f);
}
Signed-off-by: Kumar Kartikeya Dwivedi <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/sctop.py')
0 files changed, 0 insertions, 0 deletions