Home
last modified time | relevance | path

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

/kernel/linux/linux-5.10/tools/bpf/bpftool/
Dcgroup.c91 static int count_attached_bpf_progs(int cgroup_fd, enum bpf_attach_type type) in count_attached_bpf_progs() argument
96 ret = bpf_prog_query(cgroup_fd, type, query_flags, NULL, in count_attached_bpf_progs()
104 static int cgroup_has_attached_progs(int cgroup_fd) in cgroup_has_attached_progs() argument
110 int count = count_attached_bpf_progs(cgroup_fd, type); in cgroup_has_attached_progs()
123 static int show_attached_bpf_progs(int cgroup_fd, enum bpf_attach_type type, in show_attached_bpf_progs() argument
134 ret = bpf_prog_query(cgroup_fd, type, query_flags, &attach_flags, in show_attached_bpf_progs()
169 int cgroup_fd; in do_show() local
193 cgroup_fd = open(path, O_RDONLY); in do_show()
194 if (cgroup_fd < 0) { in do_show()
199 has_attached_progs = cgroup_has_attached_progs(cgroup_fd); in do_show()
[all …]
/kernel/linux/linux-5.10/tools/testing/selftests/bpf/prog_tests/
Dconnect_force_port.c49 static int run_test(int cgroup_fd, int server_fd, int family, int type) in run_test() argument
77 err = bpf_prog_attach(bpf_program__fd(prog), cgroup_fd, v4 ? in run_test()
93 err = bpf_prog_attach(bpf_program__fd(prog), cgroup_fd, v4 ? in run_test()
109 err = bpf_prog_attach(bpf_program__fd(prog), cgroup_fd, v4 ? in run_test()
134 int server_fd, cgroup_fd; in test_connect_force_port() local
136 cgroup_fd = test__join_cgroup("/connect_force_port"); in test_connect_force_port()
137 if (CHECK_FAIL(cgroup_fd < 0)) in test_connect_force_port()
143 CHECK_FAIL(run_test(cgroup_fd, server_fd, AF_INET, SOCK_STREAM)); in test_connect_force_port()
149 CHECK_FAIL(run_test(cgroup_fd, server_fd, AF_INET6, SOCK_STREAM)); in test_connect_force_port()
155 CHECK_FAIL(run_test(cgroup_fd, server_fd, AF_INET, SOCK_DGRAM)); in test_connect_force_port()
[all …]
Dsockopt_sk.c166 static int prog_attach(struct bpf_object *obj, int cgroup_fd, const char *title) in prog_attach() argument
185 err = bpf_prog_attach(bpf_program__fd(prog), cgroup_fd, in prog_attach()
195 static void run_test(int cgroup_fd) in run_test() argument
208 err = prog_attach(obj, cgroup_fd, "cgroup/getsockopt"); in run_test()
212 err = prog_attach(obj, cgroup_fd, "cgroup/setsockopt"); in run_test()
224 int cgroup_fd; in test_sockopt_sk() local
226 cgroup_fd = test__join_cgroup("/sockopt_sk"); in test_sockopt_sk()
227 if (CHECK_FAIL(cgroup_fd < 0)) in test_sockopt_sk()
230 run_test(cgroup_fd); in test_sockopt_sk()
231 close(cgroup_fd); in test_sockopt_sk()
Dsockopt_inherit.c139 static int prog_attach(struct bpf_object *obj, int cgroup_fd, const char *title) in prog_attach() argument
158 err = bpf_prog_attach(bpf_program__fd(prog), cgroup_fd, in prog_attach()
168 static void run_test(int cgroup_fd) in run_test() argument
184 err = prog_attach(obj, cgroup_fd, "cgroup/getsockopt"); in run_test()
188 err = prog_attach(obj, cgroup_fd, "cgroup/setsockopt"); in run_test()
228 int cgroup_fd; in test_sockopt_inherit() local
230 cgroup_fd = test__join_cgroup("/sockopt_inherit"); in test_sockopt_inherit()
231 if (CHECK_FAIL(cgroup_fd < 0)) in test_sockopt_inherit()
234 run_test(cgroup_fd); in test_sockopt_inherit()
235 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()
25 skel->links.sock_release = bpf_program__attach_cgroup(skel->progs.sock_release, cgroup_fd); in test_udp_limit()
74 close(cgroup_fd); in test_udp_limit()
Dtcp_rtt.c92 static int run_test(int cgroup_fd, int server_fd) in run_test() argument
115 err = bpf_prog_attach(prog_fd, cgroup_fd, BPF_CGROUP_SOCK_OPS, 0); in run_test()
158 int server_fd, cgroup_fd; in test_tcp_rtt() local
160 cgroup_fd = test__join_cgroup("/tcp_rtt"); in test_tcp_rtt()
161 if (CHECK_FAIL(cgroup_fd < 0)) in test_tcp_rtt()
168 CHECK_FAIL(run_test(cgroup_fd, server_fd)); in test_tcp_rtt()
173 close(cgroup_fd); in test_tcp_rtt()
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) 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) in prog_detach() argument
49 err = bpf_prog_detach2(bpf_program__fd(prog), cgroup_fd, in prog_detach()
Dsockopt.c877 static int run_test(int cgroup_fd, struct sockopt_test *test) in run_test() argument
892 err = bpf_prog_attach(prog_fd, cgroup_fd, test->attach_type, 0); in run_test()
965 bpf_prog_detach2(prog_fd, cgroup_fd, test->attach_type); in run_test()
973 int cgroup_fd, i; in test_sockopt() local
975 cgroup_fd = test__join_cgroup("/sockopt"); in test_sockopt()
976 if (CHECK_FAIL(cgroup_fd < 0)) in test_sockopt()
981 CHECK_FAIL(run_test(cgroup_fd, &tests[i])); in test_sockopt()
984 close(cgroup_fd); in test_sockopt()
/kernel/linux/linux-5.10/tools/testing/selftests/bpf/
Dtest_dev_cgroup.c27 int prog_fd, cgroup_fd; in main() local
36 cgroup_fd = cgroup_setup_and_join(TEST_CGROUP); in main()
37 if (cgroup_fd < 0) { in main()
43 if (bpf_prog_attach(prog_fd, cgroup_fd, BPF_CGROUP_DEVICE, 0)) { in main()
48 if (bpf_prog_query(cgroup_fd, BPF_CGROUP_DEVICE, 0, NULL, NULL, in main()
Dtest_netcnt.c42 int prog_fd, cgroup_fd; in main() local
61 cgroup_fd = cgroup_setup_and_join(TEST_CGROUP); in main()
62 if (cgroup_fd < 0) in main()
66 if (bpf_prog_attach(prog_fd, cgroup_fd, BPF_CGROUP_INET_EGRESS, 0)) { in main()
76 if (bpf_prog_query(cgroup_fd, BPF_CGROUP_INET_EGRESS, 0, NULL, NULL, in main()
Dget_cgroup_id_user.c53 int cgroup_fd, cgidmap_fd, pidmap_fd; in main() local
61 cgroup_fd = cgroup_setup_and_join(TEST_CGROUP); in main()
62 if (CHECK(cgroup_fd < 0, "cgroup_setup_and_join", "err %d errno %d\n", cgroup_fd, errno)) in main()
Dtest_cgroup_storage.c40 int map_fd, percpu_map_fd, prog_fd, cgroup_fd; in main() local
77 cgroup_fd = cgroup_setup_and_join(TEST_CGROUP); in main()
80 if (bpf_prog_attach(prog_fd, cgroup_fd, BPF_CGROUP_INET_EGRESS, 0)) { in main()
/kernel/linux/linux-5.10/tools/testing/selftests/cgroup/
Dcgroup_util.c335 pid_t clone_into_cgroup(int cgroup_fd) in clone_into_cgroup() argument
343 .cgroup = cgroup_fd, in clone_into_cgroup()
412 int cgroup_fd; in clone_into_cgroup_run_nowait() local
415 cgroup_fd = dirfd_open_opath(cgroup); in clone_into_cgroup_run_nowait()
416 if (cgroup_fd < 0) in clone_into_cgroup_run_nowait()
419 pid = clone_into_cgroup(cgroup_fd); in clone_into_cgroup_run_nowait()
420 close_prot_errno(cgroup_fd); in clone_into_cgroup_run_nowait()
557 int cgroup_fd; in clone_into_cgroup_run_wait() local
560 cgroup_fd = dirfd_open_opath(cgroup); in clone_into_cgroup_run_wait()
561 if (cgroup_fd < 0) in clone_into_cgroup_run_wait()
[all …]
Dtest_core.c143 int cgroup_fd = -EBADF; in test_cgcore_populated() local
197 cgroup_fd = dirfd_open_opath(cg_test_d); in test_cgcore_populated()
198 if (cgroup_fd < 0) in test_cgcore_populated()
201 pid = clone_into_cgroup(cgroup_fd); in test_cgcore_populated()
233 pid = clone_into_cgroup(cgroup_fd); in test_cgcore_populated()
257 if (cgroup_fd >= 0) in test_cgcore_populated()
258 close(cgroup_fd); in test_cgcore_populated()
Dcgroup_util.h53 extern pid_t clone_into_cgroup(int cgroup_fd);
/kernel/linux/linux-5.10/tools/lib/bpf/
Dlibbpf.h259 bpf_program__attach_cgroup(struct bpf_program *prog, int cgroup_fd);
Dlibbpf.c9734 bpf_program__attach_cgroup(struct bpf_program *prog, int cgroup_fd) in bpf_program__attach_cgroup() argument
9736 return bpf_program__attach_fd(prog, cgroup_fd, 0, "cgroup"); in bpf_program__attach_cgroup()
/kernel/linux/linux-5.10/kernel/events/
Dcore.c11244 void *context, int cgroup_fd) in perf_event_alloc() argument
11373 if (pmu->task_ctx_nr == perf_invalid_context && cgroup_fd != -1) { in perf_event_alloc()
11384 if (cgroup_fd != -1) { in perf_event_alloc()
11385 err = perf_cgroup_connect(cgroup_fd, event, attr, group_leader); in perf_event_alloc()
11748 int cgroup_fd = -1; in SYSCALL_DEFINE5() local
11838 cgroup_fd = pid; in SYSCALL_DEFINE5()
11841 NULL, NULL, cgroup_fd); in SYSCALL_DEFINE5()