> Could I add helper function to implement this function which can check
> the program name and see if it attach to the device.
You just need to call bpf_prog_get_fd_by_id() followed by
bpf_obj_get_info_by_fd(), and the program name will be in info.name.
Here's an example in libxdp where we pull out the prog name:
https://github.com/xdp-project/xdp-tools/blob/master/lib/libxdp/libxdp.c#L1165
-Toke