Skip to content

Commit

Permalink
libbpf-tools: small clean ups across all tools
Browse files Browse the repository at this point in the history
Remove BPF_F_CURRENT_CPU definitions, which are now provided by vmlinux.h
after 1aae4bdd7879 ("bpf: Switch BPF UAPI #define constants used from BPF
program side to enums") commit in kernel.

Fix potential uninitialized read warning in opensnoop.

Also add opensnoop to .gitignore.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
  • Loading branch information
anakryiko authored and yonghong-song committed Mar 12, 2020
1 parent 77d60b1 commit 454b138
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 11 deletions.
3 changes: 2 additions & 1 deletion libbpf-tools/.gitignore
@@ -1,3 +1,4 @@
/.output
/runqslower
/drsnoop
/opensnoop
/runqslower
3 changes: 0 additions & 3 deletions libbpf-tools/drsnoop.bpf.c
Expand Up @@ -4,9 +4,6 @@
#include <bpf/bpf_helpers.h>
#include "drsnoop.h"

#define BPF_F_INDEX_MASK 0xffffffffULL
#define BPF_F_CURRENT_CPU BPF_F_INDEX_MASK

const volatile pid_t targ_pid = 0;
const volatile pid_t targ_tgid = 0;
const volatile __u64 vm_zone_stat_kaddr = 0;
Expand Down
3 changes: 0 additions & 3 deletions libbpf-tools/opensnoop.bpf.c
Expand Up @@ -7,9 +7,6 @@

#define TASK_RUNNING 0

#define BPF_F_INDEX_MASK 0xffffffffULL
#define BPF_F_CURRENT_CPU BPF_F_INDEX_MASK

const volatile __u64 min_us = 0;
const volatile pid_t targ_pid = 0;
const volatile pid_t targ_tgid = 0;
Expand Down
2 changes: 1 addition & 1 deletion libbpf-tools/opensnoop.c
Expand Up @@ -229,7 +229,7 @@ int main(int argc, char **argv)
struct perf_buffer_opts pb_opts;
struct perf_buffer *pb = NULL;
struct opensnoop_bpf *obj;
__u64 time_end;
__u64 time_end = 0;
int err;

err = argp_parse(&argp, argc, argv, 0, NULL, NULL);
Expand Down
3 changes: 0 additions & 3 deletions libbpf-tools/runqslower.bpf.c
Expand Up @@ -6,9 +6,6 @@

#define TASK_RUNNING 0

#define BPF_F_INDEX_MASK 0xffffffffULL
#define BPF_F_CURRENT_CPU BPF_F_INDEX_MASK

const volatile __u64 min_us = 0;
const volatile pid_t targ_pid = 0;
const volatile pid_t targ_tgid = 0;
Expand Down

0 comments on commit 454b138

Please sign in to comment.