Home
last modified time | relevance | path

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

/linux/tools/testing/selftests/bpf/prog_tests/
H A Duprobe_multi_test.c381 int prog_fd, link_fd = -1; in test_attach_api_fails() local
394 link_fd = bpf_link_create(prog_fd, 0, BPF_TRACE_UPROBE_MULTI, &opts); in test_attach_api_fails()
395 if (!ASSERT_ERR(link_fd, "link_fd")) in test_attach_api_fails()
397 if (!ASSERT_EQ(link_fd, -E2BIG, "big cnt")) in test_attach_api_fails()
406 link_fd = bpf_link_create(prog_fd, 0, BPF_TRACE_UPROBE_MULTI, &opts); in test_attach_api_fails()
407 if (!ASSERT_ERR(link_fd, "link_fd")) in test_attach_api_fails()
409 if (!ASSERT_EQ(link_fd, -EINVAL, "cnt_is_zero")) in test_attach_api_fails()
418 link_fd = bpf_link_create(prog_fd, 0, BPF_TRACE_UPROBE_MULTI, &opts); in test_attach_api_fails()
419 if (!ASSERT_ERR(link_fd, "link_fd")) in test_attach_api_fails()
421 if (!ASSERT_EQ(link_fd, -EINVAL, "offset_is_negative")) in test_attach_api_fails()
[all …]
H A 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()
H A Dfill_link_info.c165 int link_fd, err; in test_kprobe_fill_link_info()
171 link_fd = bpf_link__fd(link); in test_kprobe_fill_link_info()
180 err = verify_perf_link_info(link_fd, type, kprobe_addr, 0, entry_offset); in test_kprobe_fill_link_info()
183 kprobe_fill_invalid_user_buffer(link_fd); in test_kprobe_fill_link_info()
194 int link_fd, err; in test_tp_fill_link_info()
200 link_fd = bpf_link__fd(link); in test_tp_fill_link_info()
201 err = verify_perf_link_info(link_fd, BPF_PERF_EVENT_TRACEPOINT, 0, 0, 0); in test_tp_fill_link_info()
212 int link_fd, err, pfd; in test_event_fill_link_info()
230 link_fd = bpf_link__fd(link); in test_event_fill_link_info()
231 err = verify_perf_link_info(link_fd, BPF_PERF_EVENT_EVEN in test_event_fill_link_info()
163 int link_fd, err; test_kprobe_fill_link_info() local
192 int link_fd, err; test_tp_fill_link_info() local
210 int link_fd, err, pfd; test_event_fill_link_info() local
245 int link_fd, err; test_uprobe_fill_link_info() local
365 int link_fd, err; test_kprobe_multi_fill_link_info() local
550 int link_fd, err; test_uprobe_multi_fill_link_info() local
[all...]
H A Dbpf_cookie.c613 int prog_fd, link_fd = -1; in tp_btf_subtest()
628 link_fd = bpf_raw_tracepoint_open_opts(prog_fd, &raw_tp_opts); in tp_btf_subtest()
629 if (!ASSERT_GE(link_fd, 0, "bpf_raw_tracepoint_open_opts")) in tp_btf_subtest()
633 close(link_fd); /* detach */ in tp_btf_subtest()
634 link_fd = -1; in tp_btf_subtest()
642 link_fd = bpf_link_create(prog_fd, 0, BPF_TRACE_RAW_TP, &link_opts); in tp_btf_subtest()
643 if (!ASSERT_GE(link_fd, 0, "bpf_link_create")) in tp_btf_subtest()
647 close(link_fd); /* detach */ in tp_btf_subtest()
648 link_fd = -1; in tp_btf_subtest()
667 if (link_fd > in verify_raw_tp_link_info()
601 int prog_fd, link_fd = -1; tp_btf_subtest() local
682 int err, prog_fd, link_fd = -1; raw_tp_subtest() local
[all...]
H A 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()
H A 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()
H A 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()
H A 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()
H A 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()
H A Dunpriv_bpf_disabled.c46 int i, nr_cpus, link_fd = -1; in sysctl_set()
110 link_fd = bpf_link_create(bpf_program__fd(skel->progs.handle_perf_event), perf_fd, in test_unpriv_bpf_disabled_positive()
112 ASSERT_GT(link_fd, 0, "link_create"); in test_unpriv_bpf_disabled_positive()
115 if (link_fd) in test_unpriv_bpf_disabled_positive()
116 close(link_fd); in test_unpriv_bpf_disabled_positive()
65 int i, nr_cpus, link_fd = -1; test_unpriv_bpf_disabled_positive() local
H A 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()
H A 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()
H A 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/tools/lib/bpf/
H A Dfeatures.c342 int prog_fd, link_fd, err; in probe_perf_link() local
352 link_fd = bpf_link_create(prog_fd, -1, BPF_PERF_EVENT, NULL); in probe_perf_link()
355 if (link_fd >= 0) in probe_perf_link()
356 close(link_fd); in probe_perf_link()
359 return link_fd < 0 && err == -EBADF; in probe_perf_link()
374 int prog_fd, link_fd, err; in probe_uprobe_multi_link() local
387 link_fd = bpf_link_create(prog_fd, -1, BPF_TRACE_UPROBE_MULTI, &link_opts); in probe_uprobe_multi_link()
390 if (link_fd >= 0 || err != -EBADF) { in probe_uprobe_multi_link()
391 if (link_fd >= 0) in probe_uprobe_multi_link()
392 close(link_fd); in probe_uprobe_multi_link()
[all...]
H A Dlibbpf.c11424 int prog_fd, link_fd = -1, err; in perf_event_open_probe()
11454 link_fd = bpf_link_create(prog_fd, pfd, BPF_PERF_EVENT, &link_opts); in append_to_file()
11455 if (link_fd < 0) { in append_to_file()
11461 link->link.fd = link_fd; in append_to_file()
11492 if (link_fd >= 0) in tracefs_kprobe_events()
11493 close(link_fd);
12173 int err, link_fd, prog_fd; in attach_kprobe_multi()
12255 link_fd = bpf_link_create(prog_fd, 0, attach_type, &lopts); in add_uprobe_event_legacy()
12256 if (link_fd < 0) { in add_uprobe_event_legacy()
12270 link->fd = link_fd; in determine_uprobe_perf_type_legacy()
11264 int prog_fd, link_fd = -1, err; bpf_program__attach_perf_event_opts() local
12011 int err, link_fd, prog_fd; bpf_program__attach_kprobe_multi_opts() local
12468 int err = 0, link_fd, prog_fd; bpf_program__attach_uprobe_multi() local
13156 int prog_fd, link_fd; bpf_program_attach_fd() local
13347 int prog_fd, link_fd; bpf_program__attach_iter() local
13391 int prog_fd, link_fd; bpf_program__attach_netfilter() local
[all...]
/linux/tools/testing/selftests/hid/
H A Dhid_bpf.c270 int err, link_fd; in TEST_F() local
277 link_fd = bpf_link__fd(link); in TEST_F()
278 ASSERT_GE(link_fd, 0) TH_LOG("HID-BPF link FD not valid"); in TEST_F()
297 err = bpf_obj_pin(link_fd, PIN_PATH); in TEST_F()
/linux/tools/perf/util/
H A Dbpf_counter.c463 int link_fd, diff_map_fd, err; in bperf_reload_leader_program()
486 link_fd = bpf_link__fd(link); in bperf_reload_leader_program()
488 entry->link_id = bpf_link_get_id(link_fd); in bperf_reload_leader_program()
461 int link_fd, diff_map_fd, err; bperf_reload_leader_program() local
/linux/Documentation/hid/
H A 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/tools/include/uapi/linux/
H A Dbpf.h801 * Update the eBPF program in the specified *link_fd* to
851 * Create an iterator on top of the specified *link_fd* (as
858 * using the eBPF program attached to *link_fd*.
866 * Forcefully detach the specified *link_fd* from its
1868 __u32 link_fd; /* link fd */
1889 __u32 link_fd;
1897 __u32 link_fd;
1842 __u32 link_fd; /* link fd */ global() member
1863 __u32 link_fd; global() member
1871 __u32 link_fd; global() member
/linux/kernel/bpf/
H A Dsyscall.c5850 link = bpf_link_get_from_fd(attr->link_update.link_fd); in link_update()
5892 #define BPF_LINK_DETACH_LAST_FIELD link_detach.link_fd
5902 link = bpf_link_get_from_fd(attr->link_detach.link_fd); in link_detach()
6054 link = bpf_link_get_from_fd(attr->iter_create.link_fd); in bpf_iter_create()