Home
last modified time | relevance | path

Searched refs:cgroup_fd (Results 1 – 23 of 23) sorted by relevance

/external/bpftool/src/
Dcgroup.c93 static int count_attached_bpf_progs(int cgroup_fd, enum bpf_attach_type type) in count_attached_bpf_progs() argument
98 ret = bpf_prog_query(cgroup_fd, type, query_flags, NULL, in count_attached_bpf_progs()
106 static int cgroup_has_attached_progs(int cgroup_fd) in cgroup_has_attached_progs() argument
112 int count = count_attached_bpf_progs(cgroup_fd, type); in cgroup_has_attached_progs()
125 static int show_attached_bpf_progs(int cgroup_fd, enum bpf_attach_type type, in show_attached_bpf_progs() argument
136 ret = bpf_prog_query(cgroup_fd, type, query_flags, &attach_flags, in show_attached_bpf_progs()
171 int cgroup_fd; in do_show() local
195 cgroup_fd = open(path, O_RDONLY); in do_show()
196 if (cgroup_fd < 0) { in do_show()
201 has_attached_progs = cgroup_has_attached_progs(cgroup_fd); in do_show()
[all …]
/external/linux-kselftest/tools/testing/selftests/bpf/prog_tests/
Dcgroup_v1v2.c10 static int run_test(int cgroup_fd, int server_fd, bool classid) in run_test() argument
24 cgroup_fd); in run_test()
48 int server_fd, client_fd, cgroup_fd; in test_cgroup_v1v2() local
64 cgroup_fd = test__join_cgroup("/connect_dropper"); in test_cgroup_v1v2()
65 if (!ASSERT_GE(cgroup_fd, 0, "cgroup_fd")) in test_cgroup_v1v2()
69 close(cgroup_fd); in test_cgroup_v1v2()
72 ASSERT_OK(run_test(cgroup_fd, server_fd, false), "cgroup-v2-only"); in test_cgroup_v1v2()
75 ASSERT_OK(run_test(cgroup_fd, server_fd, true), "cgroup-v1v2"); in test_cgroup_v1v2()
78 close(cgroup_fd); in test_cgroup_v1v2()
Dconnect_force_port.c49 static int run_test(int cgroup_fd, int server_fd, int family, int type) in run_test() argument
78 err = bpf_prog_attach(bpf_program__fd(prog), cgroup_fd, v4 ? in run_test()
94 err = bpf_prog_attach(bpf_program__fd(prog), cgroup_fd, v4 ? in run_test()
110 err = bpf_prog_attach(bpf_program__fd(prog), cgroup_fd, v4 ? in run_test()
135 int server_fd, cgroup_fd; in test_connect_force_port() local
137 cgroup_fd = test__join_cgroup("/connect_force_port"); in test_connect_force_port()
138 if (CHECK_FAIL(cgroup_fd < 0)) in test_connect_force_port()
144 CHECK_FAIL(run_test(cgroup_fd, server_fd, AF_INET, SOCK_STREAM)); in test_connect_force_port()
150 CHECK_FAIL(run_test(cgroup_fd, server_fd, AF_INET6, SOCK_STREAM)); in test_connect_force_port()
156 CHECK_FAIL(run_test(cgroup_fd, server_fd, AF_INET, SOCK_DGRAM)); in test_connect_force_port()
[all …]
Dsockopt_inherit.c139 static int prog_attach(struct bpf_object *obj, int cgroup_fd, const char *title, in prog_attach() argument
159 err = bpf_prog_attach(bpf_program__fd(prog), cgroup_fd, in prog_attach()
169 static void run_test(int cgroup_fd) in run_test() argument
185 err = prog_attach(obj, cgroup_fd, "cgroup/getsockopt", "_getsockopt"); in run_test()
189 err = prog_attach(obj, cgroup_fd, "cgroup/setsockopt", "_setsockopt"); in run_test()
229 int cgroup_fd; in test_sockopt_inherit() local
231 cgroup_fd = test__join_cgroup("/sockopt_inherit"); in test_sockopt_inherit()
232 if (CHECK_FAIL(cgroup_fd < 0)) in test_sockopt_inherit()
235 run_test(cgroup_fd); in test_sockopt_inherit()
236 close(cgroup_fd); in test_sockopt_inherit()
Dudp_limit.c14 int cgroup_fd; in test_udp_limit() local
16 cgroup_fd = test__join_cgroup("/udp_limit"); in test_udp_limit()
17 if (CHECK(cgroup_fd < 0, "cg-join", "errno %d", errno)) in test_udp_limit()
24 skel->links.sock = bpf_program__attach_cgroup(skel->progs.sock, cgroup_fd); in test_udp_limit()
27 skel->links.sock_release = bpf_program__attach_cgroup(skel->progs.sock_release, cgroup_fd); in test_udp_limit()
73 close(cgroup_fd); in test_udp_limit()
Dsocket_cookie.c18 int server_fd = 0, client_fd = 0, cgroup_fd = 0, err = 0; in test_socket_cookie() local
29 cgroup_fd = test__join_cgroup("/socket_cookie"); in test_socket_cookie()
30 if (CHECK(cgroup_fd < 0, "join_cgroup", "cgroup creation failed\n")) in test_socket_cookie()
34 skel->progs.set_cookie, cgroup_fd); in test_socket_cookie()
39 skel->progs.update_cookie_sockops, cgroup_fd); in test_socket_cookie()
73 close(cgroup_fd); in test_socket_cookie()
Dnetns_cookie.c15 int server_fd = -1, client_fd = -1, cgroup_fd = -1; in test_netns_cookie() local
26 cgroup_fd = test__join_cgroup("/netns_cookie"); in test_netns_cookie()
27 if (CHECK(cgroup_fd < 0, "join_cgroup", "cgroup creation failed\n")) in test_netns_cookie()
31 skel->progs.get_netns_cookie_sockops, cgroup_fd); in test_netns_cookie()
77 if (cgroup_fd != -1) in test_netns_cookie()
78 close(cgroup_fd); in test_netns_cookie()
Dtcp_rtt.c93 static int run_test(int cgroup_fd, int server_fd) in run_test() argument
108 err = bpf_prog_attach(prog_fd, cgroup_fd, BPF_CGROUP_SOCK_OPS, 0); in run_test()
151 int server_fd, cgroup_fd; in test_tcp_rtt() local
153 cgroup_fd = test__join_cgroup("/tcp_rtt"); in test_tcp_rtt()
154 if (CHECK_FAIL(cgroup_fd < 0)) in test_tcp_rtt()
161 CHECK_FAIL(run_test(cgroup_fd, server_fd)); in test_tcp_rtt()
166 close(cgroup_fd); in test_tcp_rtt()
Dsockopt_sk.c195 static void run_test(int cgroup_fd) in run_test() argument
206 bpf_program__attach_cgroup(skel->progs._setsockopt, cgroup_fd); in run_test()
211 bpf_program__attach_cgroup(skel->progs._getsockopt, cgroup_fd); in run_test()
223 int cgroup_fd; in test_sockopt_sk() local
225 cgroup_fd = test__join_cgroup("/sockopt_sk"); in test_sockopt_sk()
226 if (CHECK_FAIL(cgroup_fd < 0)) in test_sockopt_sk()
229 run_test(cgroup_fd); in test_sockopt_sk()
230 close(cgroup_fd); in test_sockopt_sk()
Dbind_perm.c76 int cgroup_fd; in test_bind_perm() local
78 cgroup_fd = test__join_cgroup("/bind_perm"); in test_bind_perm()
79 if (CHECK(cgroup_fd < 0, "cg-join", "errno %d", errno)) in test_bind_perm()
86 skel->links.bind_v4_prog = bpf_program__attach_cgroup(skel->progs.bind_v4_prog, cgroup_fd); in test_bind_perm()
90 skel->links.bind_v6_prog = bpf_program__attach_cgroup(skel->progs.bind_v6_prog, cgroup_fd); in test_bind_perm()
108 close(cgroup_fd); in test_bind_perm()
Dload_bytes_relative.c12 int server_fd, cgroup_fd, prog_fd, map_fd, client_fd; in test_load_bytes_relative() local
22 cgroup_fd = test__join_cgroup("/load_bytes_relative"); in test_load_bytes_relative()
23 if (CHECK_FAIL(cgroup_fd < 0)) in test_load_bytes_relative()
47 err = bpf_prog_attach(prog_fd, cgroup_fd, BPF_CGROUP_INET_EGRESS, in test_load_bytes_relative()
70 close(cgroup_fd); in test_load_bytes_relative()
Dsockopt_multi.c5 static int prog_attach(struct bpf_object *obj, int cgroup_fd, const char *title, const char *name) in prog_attach() argument
24 err = bpf_prog_attach(bpf_program__fd(prog), cgroup_fd, in prog_attach()
34 static int prog_detach(struct bpf_object *obj, int cgroup_fd, const char *title, const char *name) in prog_detach() argument
49 err = bpf_prog_detach2(bpf_program__fd(prog), cgroup_fd, in prog_detach()
Dsockopt.c876 static int run_test(int cgroup_fd, struct sockopt_test *test) in run_test() argument
891 err = bpf_prog_attach(prog_fd, cgroup_fd, test->attach_type, 0); in run_test()
964 bpf_prog_detach2(prog_fd, cgroup_fd, test->attach_type); in run_test()
972 int cgroup_fd, i; in test_sockopt() local
974 cgroup_fd = test__join_cgroup("/sockopt"); in test_sockopt()
975 if (CHECK_FAIL(cgroup_fd < 0)) in test_sockopt()
980 CHECK_FAIL(run_test(cgroup_fd, &tests[i])); in test_sockopt()
983 close(cgroup_fd); in test_sockopt()
/external/linux-kselftest/tools/testing/selftests/bpf/
Dtest_dev_cgroup.c28 int prog_fd, cgroup_fd; in main() local
37 cgroup_fd = cgroup_setup_and_join(TEST_CGROUP); in main()
38 if (cgroup_fd < 0) { in main()
44 if (bpf_prog_attach(prog_fd, cgroup_fd, BPF_CGROUP_DEVICE, 0)) { in main()
49 if (bpf_prog_query(cgroup_fd, BPF_CGROUP_DEVICE, 0, NULL, NULL, in main()
Dget_cgroup_id_user.c54 int cgroup_fd, cgidmap_fd, pidmap_fd; in main() local
66 cgroup_fd = cgroup_setup_and_join(TEST_CGROUP); in main()
67 if (CHECK(cgroup_fd < 0, "cgroup_setup_and_join", "err %d errno %d\n", cgroup_fd, errno)) in main()
Dtest_cgroup_storage.c41 int map_fd, percpu_map_fd, prog_fd, cgroup_fd; in main() local
78 cgroup_fd = cgroup_setup_and_join(TEST_CGROUP); in main()
81 if (bpf_prog_attach(prog_fd, cgroup_fd, BPF_CGROUP_INET_EGRESS, 0)) { in main()
/external/linux-kselftest/tools/testing/selftests/cgroup/
Dcgroup_util.c341 pid_t clone_into_cgroup(int cgroup_fd) in clone_into_cgroup() argument
349 .cgroup = cgroup_fd, in clone_into_cgroup()
418 int cgroup_fd; in clone_into_cgroup_run_nowait() local
421 cgroup_fd = dirfd_open_opath(cgroup); in clone_into_cgroup_run_nowait()
422 if (cgroup_fd < 0) in clone_into_cgroup_run_nowait()
425 pid = clone_into_cgroup(cgroup_fd); in clone_into_cgroup_run_nowait()
426 close_prot_errno(cgroup_fd); in clone_into_cgroup_run_nowait()
563 int cgroup_fd; in clone_into_cgroup_run_wait() local
566 cgroup_fd = dirfd_open_opath(cgroup); in clone_into_cgroup_run_wait()
567 if (cgroup_fd < 0) in clone_into_cgroup_run_wait()
[all …]
Dtest_core.c146 int cgroup_fd = -EBADF; in test_cgcore_populated() local
200 cgroup_fd = dirfd_open_opath(cg_test_d); in test_cgcore_populated()
201 if (cgroup_fd < 0) in test_cgcore_populated()
204 pid = clone_into_cgroup(cgroup_fd); in test_cgcore_populated()
236 pid = clone_into_cgroup(cgroup_fd); in test_cgcore_populated()
260 if (cgroup_fd >= 0) in test_cgcore_populated()
261 close(cgroup_fd); in test_cgcore_populated()
Dcgroup_util.h53 extern pid_t clone_into_cgroup(int cgroup_fd);
/external/libbpf/src/
Dlibbpf.h509 bpf_program__attach_cgroup(const struct bpf_program *prog, int cgroup_fd);
Dlibbpf.c10552 bpf_program__attach_cgroup(const struct bpf_program *prog, int cgroup_fd) in bpf_program__attach_cgroup() argument
10554 return bpf_program__attach_fd(prog, cgroup_fd, 0, "cgroup"); in bpf_program__attach_cgroup()
/external/kernel-headers/original/uapi/linux/
Dbpf.h110 __u32 cgroup_fd; member
/external/bcc/docs/
Dreference_guide.md1876 b.attach_func(fn, cgroup_fd, BPFAttachType.CGROUP_SOCK_OPS)
1895 b.detach_func(fn, cgroup_fd, BPFAttachType.CGROUP_SOCK_OPS)