History

Merge branch 'samples/bpf: fix LLVM compilation warning'

"Daniel T. Lee" says: ==================== Currently, compiling samples/bpf with LLVM emits several warning. They are only small details, but they do not appear when compiled with GCC. Detailed compilation command and warning logs can be found from bpf CI. ====================

Martin KaFai Lau committed 3 years ago

Commit 64f46602 parents e2bb9e0 68be98e3 files · +6 −9Browse files

Unified · Split

3 files
  1. samples/bpf/test_current_task_under_cgroup_user.c +4 −2
  2. samples/bpf/test_lru_dist.c +0 −5
  3. samples/bpf/tracex4_user.c +2 −2
samples/bpf/test_current_task_under_cgroup_user.c+4−2
@@ -14,9 +14,9 @@ · 13 unmodified lines
14int main(int argc, char **argv)14int main(int argc, char **argv)
15{15{
16 pid_t remote_pid, local_pid = getpid();16 pid_t remote_pid, local_pid = getpid();
17 int cg2 = -1, idx = 0, rc = 1;
17 struct bpf_link *link = NULL;18 struct bpf_link *link = NULL;
18 struct bpf_program *prog;19 struct bpf_program *prog;
19 int cg2, idx = 0, rc = 1;
20 struct bpf_object *obj;20 struct bpf_object *obj;
21 char filename[256];21 char filename[256];
22 int map_fd[2];22 int map_fd[2];
@@ -103,7 +103,9 @@ int main(int argc, char **argv) · 80 unmodified lines
103 rc = 0;103 rc = 0;
104 104
105err:105err:
106 close(cg2);106 if (cg2 != -1)
107 close(cg2);
108
107 cleanup_cgroup_environment();109 cleanup_cgroup_environment();
108 110
109cleanup:111cleanup:
samples/bpf/test_lru_dist.c+0−5
@@ -42,11 +42,6 @@ static inline void INIT_LIST_HEAD(struct list_head *list) · 41 unmodified lines
42 list->prev = list;42 list->prev = list;
43}43}
44 44
45static inline int list_empty(const struct list_head *head)
46{
47 return head->next == head;
48}
49
50static inline void __list_add(struct list_head *new,45static inline void __list_add(struct list_head *new,
51 struct list_head *prev,46 struct list_head *prev,
52 struct list_head *next)47 struct list_head *next)
samples/bpf/tracex4_user.c+2−2
@@ -51,7 +51,7 @@ int main(int ac, char **argv) · 50 unmodified lines
51 struct bpf_program *prog;51 struct bpf_program *prog;
52 struct bpf_object *obj;52 struct bpf_object *obj;
53 char filename[256];53 char filename[256];
54 int map_fd, i, j = 0;54 int map_fd, j = 0;
55 55
56 snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]);56 snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]);
57 obj = bpf_object__open_file(filename, NULL);57 obj = bpf_object__open_file(filename, NULL);
@@ -82,7 +82,7 @@ int main(int ac, char **argv) · 24 unmodified lines
82 j++;82 j++;
83 }83 }
84 84
85 for (i = 0; ; i++) {85 while (1) {
86 print_old_objects(map_fd);86 print_old_objects(map_fd);
87 sleep(1);87 sleep(1);
88 }88 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t