Skip to content

Commit

Permalink
cc: libbpf: Fix ambiguous comment
Browse files Browse the repository at this point in the history
When creating [k,u]probe, comment above bpf_try_perf_event_open_with_probe()
said "new kernel API".

"new" is a relative concept and it's committed at f180ea1
("bcc: add functions to use new [k,u]probe API"), it's not "new" now.

The "new" API came from
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e12f03d

Remove "new" word and explicit provide which commit in the Linux kernel is.
  • Loading branch information
lecopzer authored and yonghong-song committed May 23, 2019
1 parent 4006bf5 commit d314015
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/cc/libbpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,9 +751,9 @@ static int bpf_get_retprobe_bit(const char *event_type)
}

/*
* new kernel API allows creating [k,u]probe with perf_event_open, which
* makes it easier to clean up the [k,u]probe. This function tries to
* create pfd with the new API.
* Kernel API with e12f03d ("perf/core: Implement the 'perf_kprobe' PMU") allows
* creating [k,u]probe with perf_event_open, which makes it easier to clean up
* the [k,u]probe. This function tries to create pfd with the perf_kprobe PMU.
*/
static int bpf_try_perf_event_open_with_probe(const char *name, uint64_t offs,
int pid, const char *event_type, int is_return)
Expand Down Expand Up @@ -941,7 +941,6 @@ static int create_probe_event(char *buf, const char *ev_name,
bool is_kprobe = strncmp("kprobe", event_type, 6) == 0;

snprintf(buf, PATH_MAX, "/sys/kernel/debug/tracing/%s_events", event_type);

kfd = open(buf, O_WRONLY | O_APPEND, 0);
if (kfd < 0) {
fprintf(stderr, "%s: open(%s): %s\n", __func__, buf,
Expand Down Expand Up @@ -1013,8 +1012,9 @@ static int bpf_attach_probe(int progfd, enum bpf_probe_attach_type attach_type,
pfd = bpf_try_perf_event_open_with_probe(config1, offset, pid, event_type,
attach_type != BPF_PROBE_ENTRY);

// If failed, most likely Kernel doesn't support the new perf_event_open API
// yet. Try create the event using debugfs.
// If failed, most likely Kernel doesn't support the perf_kprobe PMU
// (e12f03d "perf/core: Implement the 'perf_kprobe' PMU") yet.
// Try create the event using debugfs.
if (pfd < 0) {
if (create_probe_event(buf, ev_name, attach_type, config1, offset,
event_type, pid, maxactive) < 0)
Expand Down

0 comments on commit d314015

Please sign in to comment.