Commit 435dded9 authored by 4ast's avatar 4ast Committed by GitHub

Merge pull request #1702 from iovisor/yhs_dev

print out more useful attach_kprobe failure information
parents a4782bda 858a3d70
......@@ -816,8 +816,10 @@ int bpf_attach_kprobe(int progfd, enum bpf_probe_attach_type attach_type,
snprintf(buf, sizeof(buf), "%c:%ss/%s %s", attach_type==BPF_PROBE_ENTRY ? 'p' : 'r',
event_type, event_alias, fn_name);
if (write(kfd, buf, strlen(buf)) < 0) {
if (errno == EINVAL)
fprintf(stderr, "check dmesg output for possible cause\n");
if (errno == ENOENT)
fprintf(stderr, "cannot attach kprobe, probe entry may not exist\n");
else
fprintf(stderr, "cannot attach kprobe, %s\n", strerror(errno));
close(kfd);
goto error;
}
......
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