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
1414 int main(int argc, char **argv)
1515 {
1616 pid_t remote_pid, local_pid = getpid();
17+ int cg2 = -1, idx = 0, rc = 1;
1718 struct bpf_link *link = NULL;
1819 struct bpf_program *prog;
19− int cg2, idx = 0, rc = 1;
2020 struct bpf_object *obj;
2121 char filename[256];
2222 int map_fd[2];
@@ -103,7 +103,9 @@ int main(int argc, char **argv) · 80 unmodified lines
103103 rc = 0;
104104
105105 err:
106− close(cg2);
106+ if (cg2 != -1)
107+ close(cg2);
108+
107109 cleanup_cgroup_environment();
108110
109111 cleanup:
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
4242 list->prev = list;
4343 }
4444
45−static inline int list_empty(const struct list_head *head)
46−{
47− return head->next == head;
48−}
49−
5045 static inline void __list_add(struct list_head *new,
5146 struct list_head *prev,
5247 struct list_head *next)
samples/bpf/tracex4_user.c+2−2
@@ -51,7 +51,7 @@ int main(int ac, char **argv) · 50 unmodified lines
5151 struct bpf_program *prog;
5252 struct bpf_object *obj;
5353 char filename[256];
54− int map_fd, i, j = 0;
54+ int map_fd, j = 0;
5555
5656 snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]);
5757 obj = bpf_object__open_file(filename, NULL);
@@ -82,7 +82,7 @@ int main(int ac, char **argv) · 24 unmodified lines
8282 j++;
8383 }
8484
85− for (i = 0; ; i++) {
85+ while (1) {
8686 print_old_objects(map_fd);
8787 sleep(1);
8888 }

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