Home
last modified time | relevance | path

Searched refs:link_fd (Results 1 – 25 of 25) sorted by relevance

/linux-6.12.1/tools/testing/selftests/bpf/prog_tests/
Duprobe_multi_test.c366 int prog_fd, link_fd = -1; in test_attach_api_fails() local
379 link_fd = bpf_link_create(prog_fd, 0, BPF_TRACE_UPROBE_MULTI, &opts); in test_attach_api_fails()
380 if (!ASSERT_ERR(link_fd, "link_fd")) in test_attach_api_fails()
382 if (!ASSERT_EQ(link_fd, -E2BIG, "big cnt")) in test_attach_api_fails()
391 link_fd = bpf_link_create(prog_fd, 0, BPF_TRACE_UPROBE_MULTI, &opts); in test_attach_api_fails()
392 if (!ASSERT_ERR(link_fd, "link_fd")) in test_attach_api_fails()
394 if (!ASSERT_EQ(link_fd, -EINVAL, "cnt_is_zero")) in test_attach_api_fails()
403 link_fd = bpf_link_create(prog_fd, 0, BPF_TRACE_UPROBE_MULTI, &opts); in test_attach_api_fails()
404 if (!ASSERT_ERR(link_fd, "link_fd")) in test_attach_api_fails()
406 if (!ASSERT_EQ(link_fd, -EINVAL, "offset_is_negative")) in test_attach_api_fails()
[all …]
Dperf_link.c31 int pfd = -1, link_fd = -1, err; in serial_test_perf_link() local
51 link_fd = bpf_link_create(bpf_program__fd(skel->progs.handler), pfd, in serial_test_perf_link()
53 if (!ASSERT_GE(link_fd, 0, "link_fd")) in serial_test_perf_link()
57 err = bpf_link_get_info_by_fd(link_fd, &info, &info_len); in serial_test_perf_link()
72 close(link_fd); in serial_test_perf_link()
73 link_fd = -1; in serial_test_perf_link()
85 if (link_fd >= 0) in serial_test_perf_link()
86 close(link_fd); in serial_test_perf_link()
Dfexit_stress.c9 int *fd, *fexit_fd, *link_fd; in serial_test_fexit_stress() local
18 link_fd = fd + bpf_max_tramp_links; in serial_test_fexit_stress()
44 link_fd[i] = bpf_link_create(fexit_fd[i], 0, BPF_TRACE_FEXIT, NULL); in serial_test_fexit_stress()
45 if (!ASSERT_GE(link_fd[i], 0, "fexit attach")) in serial_test_fexit_stress()
54 if (link_fd[i] > 0) in serial_test_fexit_stress()
55 close(link_fd[i]); in serial_test_fexit_stress()
Dfill_link_info.c163 int link_fd, err; in test_kprobe_fill_link_info() local
169 link_fd = bpf_link__fd(link); in test_kprobe_fill_link_info()
174 err = verify_perf_link_info(link_fd, type, kprobe_addr, 0, entry_offset); in test_kprobe_fill_link_info()
177 kprobe_fill_invalid_user_buffer(link_fd); in test_kprobe_fill_link_info()
188 int link_fd, err; in test_tp_fill_link_info() local
194 link_fd = bpf_link__fd(link); in test_tp_fill_link_info()
195 err = verify_perf_link_info(link_fd, BPF_PERF_EVENT_TRACEPOINT, 0, 0, 0); in test_tp_fill_link_info()
206 int link_fd, err, pfd; in test_event_fill_link_info() local
224 link_fd = bpf_link__fd(link); in test_event_fill_link_info()
225 err = verify_perf_link_info(link_fd, BPF_PERF_EVENT_EVENT, 0, 0, 0); in test_event_fill_link_info()
[all …]
Dbpf_cookie.c579 int prog_fd, link_fd = -1; in tp_btf_subtest() local
594 link_fd = bpf_raw_tracepoint_open_opts(prog_fd, &raw_tp_opts); in tp_btf_subtest()
595 if (!ASSERT_GE(link_fd, 0, "bpf_raw_tracepoint_open_opts")) in tp_btf_subtest()
599 close(link_fd); /* detach */ in tp_btf_subtest()
600 link_fd = -1; in tp_btf_subtest()
608 link_fd = bpf_link_create(prog_fd, 0, BPF_TRACE_RAW_TP, &link_opts); in tp_btf_subtest()
609 if (!ASSERT_GE(link_fd, 0, "bpf_link_create")) in tp_btf_subtest()
613 close(link_fd); /* detach */ in tp_btf_subtest()
614 link_fd = -1; in tp_btf_subtest()
633 if (link_fd >= 0) in tp_btf_subtest()
[all …]
Dmodule_fentry_shadow.c62 int link_fd[2] = {}; in test_module_fentry_shadow() local
115 link_fd[i] = bpf_link_create(prog_fd[i], 0, BPF_TRACE_FENTRY, NULL); in test_module_fentry_shadow()
116 if (!ASSERT_GE(link_fd[i], 0, "bpf_link_create")) in test_module_fentry_shadow()
131 if (link_fd[i] > 0) in test_module_fentry_shadow()
132 close(link_fd[i]); in test_module_fentry_shadow()
Dcore_kern.c10 int link_fd; in test_core_kern_lskel() local
16 link_fd = core_kern_lskel__core_relo_proto__attach(skel); in test_core_kern_lskel()
17 if (!ASSERT_GT(link_fd, 0, "attach(core_relo_proto)")) in test_core_kern_lskel()
Dfexit_test.c10 int link_fd; in fexit_test_common() local
19 link_fd = fexit_test_lskel__test1__attach(fexit_skel); in fexit_test_common()
20 if (!ASSERT_LT(link_fd, 0, "fexit_attach_link")) in fexit_test_common()
Dfentry_test.c10 int link_fd; in fentry_test_common() local
19 link_fd = fentry_test_lskel__test1__attach(fentry_skel); in fentry_test_common()
20 if (!ASSERT_LT(link_fd, 0, "fentry_attach_link")) in fentry_test_common()
Dbpf_obj_id.c250 int link_fd, cmp_res; in serial_test_bpf_obj_id() local
255 link_fd = bpf_link_get_fd_by_id(next_id); in serial_test_bpf_obj_id()
256 if (link_fd < 0 && errno == ENOENT) in serial_test_bpf_obj_id()
259 if (!ASSERT_GE(link_fd, 0, "bpf_link_get_fd_by_id")) in serial_test_bpf_obj_id()
271 err = bpf_link_get_info_by_fd(link_fd, &link_info, &info_len); in serial_test_bpf_obj_id()
278 close(link_fd); in serial_test_bpf_obj_id()
Drecursive_attach.c118 int err, link_fd, tgt_prog_fd; in test_fentry_attach_btf_presence() local
139 link_fd = bpf_link_create(tgt_prog_fd, 0, BPF_TRACE_FENTRY, NULL); in test_fentry_attach_btf_presence()
140 if (!ASSERT_GE(link_fd, 0, "link_fd")) in test_fentry_attach_btf_presence()
Dunpriv_bpf_disabled.c65 int i, nr_cpus, link_fd = -1; in test_unpriv_bpf_disabled_positive() local
129 link_fd = bpf_link_create(bpf_program__fd(skel->progs.handle_perf_event), perf_fd, in test_unpriv_bpf_disabled_positive()
131 ASSERT_GT(link_fd, 0, "link_create"); in test_unpriv_bpf_disabled_positive()
134 if (link_fd) in test_unpriv_bpf_disabled_positive()
135 close(link_fd); in test_unpriv_bpf_disabled_positive()
Dsockopt.c1075 int sock_fd, err, prog_fd, link_fd = -1; in run_test() local
1093 link_fd = err; in run_test()
1188 if (link_fd >= 0) in run_test()
1189 close(link_fd); in run_test()
Dsockmap_listen.c774 int link_fd; in test_msg_redir_to_connected_with_link() local
776 link_fd = bpf_link_create(prog_msg_verdict, sock_map, BPF_SK_MSG_VERDICT, NULL); in test_msg_redir_to_connected_with_link()
777 if (!ASSERT_GE(link_fd, 0, "bpf_link_create")) in test_msg_redir_to_connected_with_link()
782 close(link_fd); in test_msg_redir_to_connected_with_link()
/linux-6.12.1/tools/lib/bpf/
Dfeatures.c347 int prog_fd, link_fd, err; in probe_perf_link() local
357 link_fd = bpf_link_create(prog_fd, -1, BPF_PERF_EVENT, NULL); in probe_perf_link()
360 if (link_fd >= 0) in probe_perf_link()
361 close(link_fd); in probe_perf_link()
364 return link_fd < 0 && err == -EBADF; in probe_perf_link()
379 int prog_fd, link_fd, err; in probe_uprobe_multi_link() local
392 link_fd = bpf_link_create(prog_fd, -1, BPF_TRACE_UPROBE_MULTI, &link_opts); in probe_uprobe_multi_link()
395 if (link_fd >= 0 || err != -EBADF) { in probe_uprobe_multi_link()
396 if (link_fd >= 0) in probe_uprobe_multi_link()
397 close(link_fd); in probe_uprobe_multi_link()
[all …]
Dbpf.h447 LIBBPF_API int bpf_link_detach(int link_fd);
457 LIBBPF_API int bpf_link_update(int link_fd, int new_prog_fd,
460 LIBBPF_API int bpf_iter_create(int link_fd);
583 LIBBPF_API int bpf_link_get_info_by_fd(int link_fd, struct bpf_link_info *info, __u32 *info_len);
Dbpf.c878 int bpf_link_detach(int link_fd) in bpf_link_detach() argument
885 attr.link_detach.link_fd = link_fd; in bpf_link_detach()
891 int bpf_link_update(int link_fd, int new_prog_fd, in bpf_link_update() argument
905 attr.link_update.link_fd = link_fd; in bpf_link_update()
917 int bpf_iter_create(int link_fd) in bpf_iter_create() argument
924 attr.iter_create.link_fd = link_fd; in bpf_iter_create()
1173 int bpf_link_get_info_by_fd(int link_fd, struct bpf_link_info *info, __u32 *info_len) in bpf_link_get_info_by_fd() argument
1175 return bpf_obj_get_info_by_fd(link_fd, info, info_len); in bpf_link_get_info_by_fd()
Dlibbpf.c10757 int prog_fd, link_fd = -1, err; in bpf_program__attach_perf_event_opts() local
10787 link_fd = bpf_link_create(prog_fd, pfd, BPF_PERF_EVENT, &link_opts); in bpf_program__attach_perf_event_opts()
10788 if (link_fd < 0) { in bpf_program__attach_perf_event_opts()
10795 link->link.fd = link_fd; in bpf_program__attach_perf_event_opts()
10823 if (link_fd >= 0) in bpf_program__attach_perf_event_opts()
10824 close(link_fd); in bpf_program__attach_perf_event_opts()
11486 int err, link_fd, prog_fd; in bpf_program__attach_kprobe_multi_opts() local
11548 link_fd = bpf_link_create(prog_fd, 0, attach_type, &lopts); in bpf_program__attach_kprobe_multi_opts()
11549 if (link_fd < 0) { in bpf_program__attach_kprobe_multi_opts()
11555 link->fd = link_fd; in bpf_program__attach_kprobe_multi_opts()
[all …]
/linux-6.12.1/tools/testing/selftests/hid/
Dhid_bpf.c293 int err, link_fd; in TEST_F() local
300 link_fd = bpf_link__fd(link); in TEST_F()
301 ASSERT_GE(link_fd, 0) TH_LOG("HID-BPF link FD not valid"); in TEST_F()
320 err = bpf_obj_pin(link_fd, PIN_PATH); in TEST_F()
/linux-6.12.1/tools/perf/util/
Dbpf_counter.c402 int link_fd, diff_map_fd, err; in bperf_reload_leader_program() local
424 link_fd = bpf_link__fd(link); in bperf_reload_leader_program()
426 entry->link_id = bpf_link_get_id(link_fd); in bperf_reload_leader_program()
/linux-6.12.1/Documentation/hid/
Dhid-bpf.rst425 int err, link_fd;
432 link_fd = bpf_map__attach_struct_ops(hid_skel->maps.haptic_tablet);
433 if (!link_fd) {
438 return link_fd; /* the fd of the created bpf_link */
/linux-6.12.1/include/uapi/linux/
Dbpf.h1785 __u32 link_fd; /* link fd */ member
1806 __u32 link_fd; member
1814 __u32 link_fd; member
/linux-6.12.1/tools/include/uapi/linux/
Dbpf.h1785 __u32 link_fd; /* link fd */ member
1806 __u32 link_fd; member
1814 __u32 link_fd; member
/linux-6.12.1/kernel/bpf/
Dsyscall.c5319 link = bpf_link_get_from_fd(attr->link_update.link_fd); in link_update()
5361 #define BPF_LINK_DETACH_LAST_FIELD link_detach.link_fd
5371 link = bpf_link_get_from_fd(attr->link_detach.link_fd); in link_detach()
5523 link = bpf_link_get_from_fd(attr->iter_create.link_fd); in bpf_iter_create()
/linux-6.12.1/Documentation/bpf/
Dbpf_iterators.rst77 * Obtain a ``link_fd`` to the BPF program by calling the ``bpf_link_create()``