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