/tools/testing/selftests/bpf/prog_tests/ |
D | pinning.c | 13 int err; in get_map_id() local 21 err = bpf_obj_get_info_by_fd(bpf_map__fd(map), in get_map_id() 23 CHECK(err, "get map info", "err %d errno %d", err, errno); in get_map_id() 40 int err, map_fd; in test_pinning() local 47 err = libbpf_get_error(obj); in test_pinning() 48 if (CHECK(err != -EINVAL, "invalid open", "err %d errno %d\n", err, errno)) { in test_pinning() 55 err = libbpf_get_error(obj); in test_pinning() 56 if (CHECK(err, "default open", "err %d errno %d\n", err, errno)) { in test_pinning() 61 err = bpf_object__load(obj); in test_pinning() 62 if (CHECK(err, "default load", "err %d errno %d\n", err, errno)) in test_pinning() [all …]
|
D | sockopt_multi.c | 10 int err; in prog_attach() local 12 err = libbpf_prog_type_by_name(title, &prog_type, &attach_type); in prog_attach() 13 if (err) { in prog_attach() 24 err = bpf_prog_attach(bpf_program__fd(prog), cgroup_fd, in prog_attach() 26 if (err) { in prog_attach() 39 int err; in prog_detach() local 41 err = libbpf_prog_type_by_name(title, &prog_type, &attach_type); in prog_detach() 42 if (err) in prog_detach() 49 err = bpf_prog_detach2(bpf_program__fd(prog), cgroup_fd, in prog_detach() 51 if (err) in prog_detach() [all …]
|
D | sockopt_sk.c | 17 int fd, err; in getsetsockopt() local 39 goto err; in getsetsockopt() 43 err = setsockopt(fd, SOL_IP, IP_TOS, big_buf, optlen); in getsetsockopt() 44 if (err) { in getsetsockopt() 46 goto err; in getsetsockopt() 51 err = getsockopt(fd, SOL_IP, IP_TOS, big_buf, &optlen); in getsetsockopt() 52 if (err) { in getsetsockopt() 54 goto err; in getsetsockopt() 60 goto err; in getsetsockopt() 66 err = setsockopt(fd, SOL_IP, IP_TTL, &buf, 1); in getsetsockopt() [all …]
|
D | xdp_attach.c | 13 int err, fd1, fd2, fd3; in test_xdp_attach() local 19 err = bpf_prog_load(file, BPF_PROG_TYPE_XDP, &obj1, &fd1); in test_xdp_attach() 20 if (CHECK_FAIL(err)) in test_xdp_attach() 22 err = bpf_obj_get_info_by_fd(fd1, &info, &len); in test_xdp_attach() 23 if (CHECK_FAIL(err)) in test_xdp_attach() 27 err = bpf_prog_load(file, BPF_PROG_TYPE_XDP, &obj2, &fd2); in test_xdp_attach() 28 if (CHECK_FAIL(err)) in test_xdp_attach() 32 err = bpf_obj_get_info_by_fd(fd2, &info, &len); in test_xdp_attach() 33 if (CHECK_FAIL(err)) in test_xdp_attach() 37 err = bpf_prog_load(file, BPF_PROG_TYPE_XDP, &obj3, &fd3); in test_xdp_attach() [all …]
|
D | lookup_and_delete.c | 16 int err; in fill_values() local 19 err = bpf_map_update_elem(map_fd, &key, &value, BPF_NOEXIST); in fill_values() 20 if (!ASSERT_OK(err, "bpf_map_update_elem")) in fill_values() 30 int i, err; in fill_values_percpu() local 36 err = bpf_map_update_elem(map_fd, &key, value, BPF_NOEXIST); in fill_values_percpu() 37 if (!ASSERT_OK(err, "bpf_map_update_elem")) in fill_values_percpu() 48 int err; in setup_prog() local 54 err = bpf_map__set_type(skel->maps.hash_map, map_type); in setup_prog() 55 if (!ASSERT_OK(err, "bpf_map__set_type")) in setup_prog() 58 err = bpf_map__set_max_entries(skel->maps.hash_map, MAX_ENTRIES); in setup_prog() [all …]
|
D | tailcalls.c | 11 int err, map_fd, prog_fd, main_fd, i, j; in test_tailcall_1() local 19 err = bpf_prog_load("tailcall1.o", BPF_PROG_TYPE_SCHED_CLS, &obj, in test_tailcall_1() 21 if (CHECK_FAIL(err)) in test_tailcall_1() 51 err = bpf_map_update_elem(map_fd, &i, &prog_fd, BPF_ANY); in test_tailcall_1() 52 if (CHECK_FAIL(err)) in test_tailcall_1() 57 err = bpf_prog_test_run(main_fd, 1, buff, sizeof(buff), 0, in test_tailcall_1() 59 CHECK(err || retval != i, "tailcall", in test_tailcall_1() 60 "err %d errno %d retval %d\n", err, errno, retval); in test_tailcall_1() 62 err = bpf_map_delete_elem(map_fd, &i); in test_tailcall_1() 63 if (CHECK_FAIL(err)) in test_tailcall_1() [all …]
|
D | test_bpffs.c | 32 int err, duration = 0; in fn() local 34 err = unshare(CLONE_NEWNS); in fn() 35 if (CHECK(err, "unshare", "failed: %d\n", errno)) in fn() 38 err = mount("", "/", "", MS_REC | MS_PRIVATE, NULL); in fn() 39 if (CHECK(err, "mount /", "failed: %d\n", errno)) in fn() 42 err = umount(TDIR); in fn() 43 if (CHECK(err, "umount " TDIR, "failed: %d\n", errno)) in fn() 46 err = mount("none", TDIR, "tmpfs", 0, NULL); in fn() 47 if (CHECK(err, "mount", "mount root failed: %d\n", errno)) in fn() 50 err = mkdir(TDIR "/fs1", 0777); in fn() [all …]
|
D | xdp_link.c | 11 __u32 duration = 0, id1, id2, id0 = 0, prog_fd1, prog_fd2, err; in test_xdp_link() local 31 err = bpf_obj_get_info_by_fd(prog_fd1, &prog_info, &prog_info_len); in test_xdp_link() 32 if (CHECK(err, "fd_info1", "failed %d\n", -errno)) in test_xdp_link() 37 err = bpf_obj_get_info_by_fd(prog_fd2, &prog_info, &prog_info_len); in test_xdp_link() 38 if (CHECK(err, "fd_info2", "failed %d\n", -errno)) in test_xdp_link() 43 err = bpf_set_link_xdp_fd_opts(IFINDEX_LO, prog_fd1, XDP_FLAGS_REPLACE, &opts); in test_xdp_link() 44 if (CHECK(err, "fd_attach", "initial prog attach failed: %d\n", err)) in test_xdp_link() 48 err = bpf_get_link_xdp_id(IFINDEX_LO, &id0, 0); in test_xdp_link() 49 CHECK(err || id0 != id1, "id1_check", in test_xdp_link() 50 "loaded prog id %u != id1 %u, err %d", id0, id1, err); in test_xdp_link() [all …]
|
D | skb_ctx.c | 30 int err; in test_skb_ctx() local 33 err = bpf_prog_load("./test_skb_ctx.o", BPF_PROG_TYPE_SCHED_CLS, &obj, in test_skb_ctx() 35 if (CHECK_ATTR(err, "load", "err %d errno %d\n", err, errno)) in test_skb_ctx() 41 err = bpf_prog_test_run_xattr(&tattr); in test_skb_ctx() 42 CHECK_ATTR(err == 0, "ctx_size_in", "err %d errno %d\n", err, errno); in test_skb_ctx() 48 err = bpf_prog_test_run_xattr(&tattr); in test_skb_ctx() 49 CHECK_ATTR(err == 0, "ctx_size_out", "err %d errno %d\n", err, errno); in test_skb_ctx() 55 err = bpf_prog_test_run_xattr(&tattr); in test_skb_ctx() 56 CHECK_ATTR(err == 0, "len", "err %d errno %d\n", err, errno); in test_skb_ctx() 60 err = bpf_prog_test_run_xattr(&tattr); in test_skb_ctx() [all …]
|
D | task_fd_query_rawtp.c | 10 int efd, err, prog_fd; in test_task_fd_query_rawtp() local 14 err = bpf_prog_load(file, BPF_PROG_TYPE_RAW_TRACEPOINT, &obj, &prog_fd); in test_task_fd_query_rawtp() 15 if (CHECK(err, "prog_load raw tp", "err %d errno %d\n", err, errno)) in test_task_fd_query_rawtp() 24 err = bpf_task_fd_query(getpid(), efd, 0, buf, &len, &prog_id, in test_task_fd_query_rawtp() 26 if (CHECK(err < 0, "bpf_task_fd_query", "err %d errno %d\n", err, in test_task_fd_query_rawtp() 30 err = fd_type == BPF_FD_TYPE_RAW_TRACEPOINT && in test_task_fd_query_rawtp() 32 if (CHECK(!err, "check_results", "fd_type %d tp_name %s\n", in test_task_fd_query_rawtp() 38 err = bpf_task_fd_query(getpid(), efd, 0, buf, &len, &prog_id, in test_task_fd_query_rawtp() 40 if (CHECK(err < 0, "bpf_task_fd_query (len = 0)", "err %d errno %d\n", in test_task_fd_query_rawtp() 41 err, errno)) in test_task_fd_query_rawtp() [all …]
|
D | migrate_reuseport.c | 150 int err = 0, fd, len; in setup_fastopen() local 159 err = -1; in setup_fastopen() 163 err = -1; in setup_fastopen() 167 err = lseek(fd, 0, SEEK_SET); in setup_fastopen() 168 if (!ASSERT_OK(err, "lseek")) in setup_fastopen() 176 err = -1; in setup_fastopen() 182 return err; in setup_fastopen() 205 int err; in pass_ack() local 207 err = bpf_link__destroy(test_case->link); in pass_ack() 208 if (!ASSERT_OK(err, "bpf_link__destroy")) in pass_ack() [all …]
|
D | cgroup_attach_override.c | 34 goto err; in test_cgroup_attach_override() 39 goto err; in test_cgroup_attach_override() 43 goto err; in test_cgroup_attach_override() 49 goto err; in test_cgroup_attach_override() 53 goto err; in test_cgroup_attach_override() 57 goto err; in test_cgroup_attach_override() 61 goto err; in test_cgroup_attach_override() 67 goto err; in test_cgroup_attach_override() 70 goto err; in test_cgroup_attach_override() 75 goto err; in test_cgroup_attach_override() [all …]
|
D | xdp_adjust_tail.c | 10 int err, prog_fd; in test_xdp_adjust_tail_shrink() local 13 err = bpf_prog_load(file, BPF_PROG_TYPE_XDP, &obj, &prog_fd); in test_xdp_adjust_tail_shrink() 14 if (CHECK_FAIL(err)) in test_xdp_adjust_tail_shrink() 17 err = bpf_prog_test_run(prog_fd, 1, &pkt_v4, sizeof(pkt_v4), in test_xdp_adjust_tail_shrink() 20 CHECK(err || retval != XDP_DROP, in test_xdp_adjust_tail_shrink() 22 err, errno, retval, size); in test_xdp_adjust_tail_shrink() 25 err = bpf_prog_test_run(prog_fd, 1, &pkt_v6, sizeof(pkt_v6), in test_xdp_adjust_tail_shrink() 27 CHECK(err || retval != XDP_TX || size != expect_sz, in test_xdp_adjust_tail_shrink() 29 err, errno, retval, size, expect_sz); in test_xdp_adjust_tail_shrink() 39 int err, prog_fd; in test_xdp_adjust_tail_grow() local [all …]
|
D | xdp_info.c | 13 int err, prog_fd; in test_xdp_info() local 17 err = bpf_get_link_xdp_id(IFINDEX_LO, &prog_id, 0); in test_xdp_info() 18 if (CHECK(err, "get_xdp_none", "errno=%d\n", errno)) in test_xdp_info() 23 err = bpf_get_link_xdp_id(IFINDEX_LO, &prog_id, XDP_FLAGS_SKB_MODE); in test_xdp_info() 24 if (CHECK(err, "get_xdp_none_skb", "errno=%d\n", errno)) in test_xdp_info() 32 err = bpf_prog_load(file, BPF_PROG_TYPE_XDP, &obj, &prog_fd); in test_xdp_info() 33 if (CHECK_FAIL(err)) in test_xdp_info() 36 err = bpf_obj_get_info_by_fd(prog_fd, &info, &len); in test_xdp_info() 37 if (CHECK(err, "get_prog_info", "errno=%d\n", errno)) in test_xdp_info() 40 err = bpf_set_link_xdp_fd(IFINDEX_LO, prog_fd, XDP_FLAGS_SKB_MODE); in test_xdp_info() [all …]
|
D | stacktrace_build_id.c | 10 int err, stack_trace_len; in test_stacktrace_build_id() local 23 err = test_stacktrace_build_id__attach(skel); in test_stacktrace_build_id() 24 if (CHECK(err, "attach_tp", "err %d\n", err)) in test_stacktrace_build_id() 45 err = compare_map_keys(stackid_hmap_fd, stackmap_fd); in test_stacktrace_build_id() 46 if (CHECK(err, "compare_map_keys stackid_hmap vs. stackmap", in test_stacktrace_build_id() 47 "err %d errno %d\n", err, errno)) in test_stacktrace_build_id() 50 err = compare_map_keys(stackmap_fd, stackid_hmap_fd); in test_stacktrace_build_id() 51 if (CHECK(err, "compare_map_keys stackmap vs. stackid_hmap", in test_stacktrace_build_id() 52 "err %d errno %d\n", err, errno)) in test_stacktrace_build_id() 55 err = extract_build_id(buf, 256); in test_stacktrace_build_id() [all …]
|
D | global_data_init.c | 7 int err = -ENOMEM, map_fd, zero = 0; in test_global_data_init() local 15 err = libbpf_get_error(obj); in test_global_data_init() 16 if (CHECK_FAIL(err)) in test_global_data_init() 30 err = bpf_map__set_initial_value(map, newval, sz - 1); in test_global_data_init() 31 if (CHECK(!err, "reject set initial value wrong size", "err %d\n", err)) in test_global_data_init() 34 err = bpf_map__set_initial_value(map, newval, sz); in test_global_data_init() 35 if (CHECK(err, "set initial value", "err %d\n", err)) in test_global_data_init() 38 err = bpf_object__load(obj); in test_global_data_init() 39 if (CHECK_FAIL(err)) in test_global_data_init() 48 err = bpf_map_lookup_elem(map_fd, &zero, buff); in test_global_data_init() [all …]
|
D | sk_storage_tracing.c | 28 int err; in check_sk_stg() local 30 err = bpf_map_lookup_elem(bpf_map__fd(skel->maps.sk_stg_map), &sk_fd, in check_sk_stg() 32 if (!ASSERT_OK(err, "map_lookup(sk_stg_map)")) in check_sk_stg() 50 int listen_fd = -1, passive_fd = -1, active_fd = -1, value = 1, err; in do_test() local 63 err = bpf_map_update_elem(bpf_map__fd(skel->maps.del_sk_stg_map), in do_test() 65 if (!ASSERT_OK(err, "map_update(del_sk_stg_map)")) in do_test() 74 err = read(passive_fd, &abyte, 1); in do_test() 75 if (!ASSERT_OK(err, "read(passive_fd)")) in do_test() 79 err = read(active_fd, &abyte, 1); in do_test() 80 if (!ASSERT_OK(err, "read(active_fd)")) in do_test() [all …]
|
/tools/testing/selftests/x86/ |
D | test_FCMOV.c | 56 int err = 0; in main() local 68 err |= !(fcmovb(0) == 1.0); err |= !(fcmovnb(0) != 1.0); in main() 69 err |= !(fcmove(0) == 1.0); err |= !(fcmovne(0) != 1.0); in main() 70 err |= !(fcmovbe(0) == 1.0); err |= !(fcmovnbe(0) != 1.0); in main() 71 err |= !(fcmovu(0) == 1.0); err |= !(fcmovnu(0) != 1.0); in main() 73 err |= !(fcmovb(CF) != 1.0); err |= !(fcmovnb(CF) == 1.0); in main() 74 err |= !(fcmove(CF) == 1.0); err |= !(fcmovne(CF) != 1.0); in main() 75 err |= !(fcmovbe(CF) != 1.0); err |= !(fcmovnbe(CF) == 1.0); in main() 76 err |= !(fcmovu(CF) == 1.0); err |= !(fcmovnu(CF) != 1.0); in main() 78 err |= !(fcmovb(ZF) == 1.0); err |= !(fcmovnb(ZF) != 1.0); in main() [all …]
|
/tools/testing/selftests/bpf/map_tests/ |
D | sk_storage_map.c | 170 int i, map_fd, err, *sk_fds; in insert_close_thread() local 189 err = -errno; in insert_close_thread() 193 err = bpf_map_update_elem(map_fd, &sk_fds[i], &value, in insert_close_thread() 195 if (err) { in insert_close_thread() 196 err = -errno; in insert_close_thread() 224 return ERR_PTR(err); in insert_close_thread() 229 int i, map_fd = -1, err = 0, nr_threads_created = 0; in do_sk_storage_map_stress_free() local 240 err = pthread_create(&sk_thread_ids[i], NULL, in do_sk_storage_map_stress_free() 242 if (err) { in do_sk_storage_map_stress_free() 243 err = -errno; in do_sk_storage_map_stress_free() [all …]
|
/tools/perf/tests/ |
D | event-times.c | 25 int err; in attach__enable_on_exec() local 29 err = evlist__create_maps(evlist, &target); in attach__enable_on_exec() 30 if (err < 0) { in attach__enable_on_exec() 32 return err; in attach__enable_on_exec() 35 err = evlist__prepare_workload(evlist, &target, argv, false, NULL); in attach__enable_on_exec() 36 if (err < 0) { in attach__enable_on_exec() 38 return err; in attach__enable_on_exec() 43 err = evlist__open(evlist); in attach__enable_on_exec() 44 if (err < 0) { in attach__enable_on_exec() 47 return err; in attach__enable_on_exec() [all …]
|
D | switch-tracking.c | 27 int err, i; in spin_sleep() local 32 err = gettimeofday(&start, NULL); in spin_sleep() 33 if (err) in spin_sleep() 34 return err; in spin_sleep() 41 err = gettimeofday(&now, NULL); in spin_sleep() 42 if (err) in spin_sleep() 43 return err; in spin_sleep() 54 err = nanosleep(&ts, NULL); in spin_sleep() 55 if (err == EINTR) in spin_sleep() 56 err = 0; in spin_sleep() [all …]
|
/tools/testing/selftests/pidfd/ |
D | pidfd_fdinfo_test.c | 25 static int error_set(struct error *err, int code, const char *fmt, ...) in error_set() argument 30 if (code == PIDFD_PASS || !err || err->code != PIDFD_PASS) in error_set() 33 err->code = code; in error_set() 35 r = vsnprintf(err->msg, sizeof(err->msg), fmt, args); in error_set() 36 assert((size_t)r < sizeof(err->msg)); in error_set() 42 static void error_report(struct error *err, const char *test_name) in error_report() argument 44 switch (err->code) { in error_report() 46 ksft_exit_fail_msg("%s test: Fatal: %s\n", test_name, err->msg); in error_report() 51 ksft_test_result_error("%s test: %s\n", test_name, err->msg); in error_report() 56 ksft_test_result_skip("%s test: %s\n", test_name, err->msg); in error_report() [all …]
|
/tools/testing/selftests/bpf/ |
D | test_skb_cgroup_id_user.c | 53 int err = 0; in send_packet() local 57 goto err; in send_packet() 62 goto err; in send_packet() 68 goto err; in send_packet() 72 err: in send_packet() 73 err = -1; in send_packet() 77 return err; in send_packet() 91 goto err; in get_map_fd_by_prog_id() 99 goto err; in get_map_fd_by_prog_id() 104 goto err; in get_map_fd_by_prog_id() [all …]
|
/tools/perf/util/arm-spe-decoder/ |
D | arm-spe-pkt-decoder.c | 253 static int arm_spe_pkt_out_string(int *err, char **buf_p, size_t *blen, in arm_spe_pkt_out_string() argument 260 if (err && *err) in arm_spe_pkt_out_string() 261 return *err; in arm_spe_pkt_out_string() 268 if (err && !*err) in arm_spe_pkt_out_string() 269 *err = ret; in arm_spe_pkt_out_string() 282 if (err && !*err) in arm_spe_pkt_out_string() 283 *err = ret; in arm_spe_pkt_out_string() 296 int err = 0; in arm_spe_pkt_desc_event() local 298 arm_spe_pkt_out_string(&err, &buf, &buf_len, "EV"); in arm_spe_pkt_desc_event() 301 arm_spe_pkt_out_string(&err, &buf, &buf_len, " EXCEPTION-GEN"); in arm_spe_pkt_desc_event() [all …]
|
/tools/testing/selftests/arm64/signal/testcases/ |
D | testcases.c | 28 bool validate_extra_context(struct extra_context *extra, char **err) in validate_extra_context() argument 32 if (!extra || !err) in validate_extra_context() 38 *err = "Missing terminator after EXTRA context"; in validate_extra_context() 42 *err = "Extra DATAP misaligned"; in validate_extra_context() 44 *err = "Extra SIZE misaligned"; in validate_extra_context() 46 *err = "Extra DATAP misplaced (not contiguous)"; in validate_extra_context() 47 if (*err) in validate_extra_context() 53 bool validate_sve_context(struct sve_context *sve, char **err) in validate_sve_context() argument 59 if (!sve || !err) in validate_sve_context() 65 *err = "bad size for SVE context"; in validate_sve_context() [all …]
|