Skip to content

Commit

Permalink
Dynamic addition of kprobe and tracepoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ZHaoXiangyuA committed Jul 9, 2024
1 parent 38ab04d commit d052e59
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions userspace/libscap/scap_bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,8 @@ static int32_t load_tracepoint(scap_t* handle, const char *event, struct bpf_ins

static bool is_kt_enabled(scap_t *handle, char* event_name){
bool enabled = true;
for(int i = 0; i < handle->m_bpf_prog_real_size; i++){
int i;
for(i = 0; i < handle->m_bpf_prog_real_size; i++){
if(strcmp(event_name, handle->kt_indices[i].name) == 0){
enabled = handle->kt_indices[i].interest;
break;
Expand Down Expand Up @@ -865,7 +866,8 @@ static int32_t load_bpf_file(scap_t *handle)
if(is_kt_enabled(handle, shname))
{
bool already_attached = false;
for(int i = 0; i < handle->m_bpf_prog_cnt && !already_attached; i++)
int i;
for(i = 0; i < handle->m_bpf_prog_cnt && !already_attached; i++)
{
if(strcmp(handle->m_bpf_progs[i].name, shname) == 0)
{
Expand Down

0 comments on commit d052e59

Please sign in to comment.