instruction
stringlengths
82
202
input
stringclasses
1 value
output
stringlengths
73
23.9M
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_struct_ops_refcounted' alt sistemi için gerekli C kaynak kodunu implemente et.
```c #include <test_progs.h> #include "struct_ops_refcounted.skel.h" #include "struct_ops_refcounted_fail__ref_leak.skel.h" #include "struct_ops_refcounted_fail__global_subprog.skel.h" #include "struct_ops_refcounted_fail__tail_call.skel.h" void test_struct_ops_refcounted(void) { RUN_TESTS(struct_ops_refcounted); R...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/nested_trust' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */ #include <test_progs.h> #include "nested_trust_failure.skel.h" #include "nested_trust_success.skel.h" #include "nested_acquire.skel.h" void test_nested_trust(void) { RUN_TESTS(nested_trust_success); RUN_TESTS(nest...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/flow_dissector_load_bytes' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include <network_helpers.h> void serial_test_flow_dissector_load_bytes(void) { struct bpf_flow_keys flow_keys; struct bpf_insn prog[] = { // BPF_REG_1 - 1st argument: context // BPF_REG_2 - 2nd argument: offset, start at first byte BPF_MOV64_IMM...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/verifier_log' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */ #include <test_progs.h> #include <bpf/btf.h> #include "test_log_buf.skel.h" static bool check_prog_load(int prog_fd, bool expect_err, const char *tag) { if (expect_err) { if (!ASSERT_LT(prog_fd, 0, tag)) { c...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/crypto_sanity' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ #include <sys/types.h> #include <sys/socket.h> #include <net/if.h> #include <linux/if_alg.h> #include "test_progs.h" #include "network_helpers.h" #include "crypto_sanity.skel.h" #include "crypto_basic.skel.h" #defi...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/fib_lookup' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */ #include <linux/rtnetlink.h> #include <sys/types.h> #include <net/if.h> #include "test_progs.h" #include "network_helpers.h" #include "fib_lookup.skel.h" #define NS_TEST "fib_lookup_ns" #define IPV6_IFACE_ADDR "...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/attach_probe' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include "test_attach_kprobe_sleepable.skel.h" #include "test_attach_probe_manual.skel.h" #include "test_attach_probe.skel.h" #include "kprobe_write_ctx.skel.h" /* this is how USDT semaphore is actually defined, except volatile modifier */ volatile unsig...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/cgroup_skb_direct_packet_access' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include "cgroup_skb_direct_packet_access.skel.h" void test_cgroup_skb_prog_run_direct_packet_access(void) { int err; struct cgroup_skb_direct_packet_access *skel; char test_skb[64] = {}; LIBBPF_OPTS(bpf_test_run_opts, topts, .data_in = test_skb,...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/cgroup_iter' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022 Google */ #include <test_progs.h> #include <bpf/libbpf.h> #include <bpf/btf.h> #include "iters_css_task.skel.h" #include "cgroup_iter.skel.h" #include "cgroup_helpers.h" #define ROOT 0 #define PARENT 1 #define CHILD1 2 #define CH...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/empty_skb' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include <network_helpers.h> #include <net/if.h> #include "empty_skb.skel.h" void test_empty_skb(void) { LIBBPF_OPTS(bpf_test_run_opts, tattr); struct empty_skb *bpf_obj = NULL; struct nstoken *tok = NULL; struct bpf_program *prog; struct ethhdr eth...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/stacktrace_map' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include "stacktrace_map.skel.h" void test_stacktrace_map(void) { struct stacktrace_map *skel; int control_map_fd, stackid_hmap_fd, stackmap_fd, stack_amap_fd; int err, stack_trace_len; __u32 key, val, stack_id, duration = 0; __u64 stack[PERF_MAX_ST...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/core_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include "test_progs.h" #include "core_kern.lskel.h" void test_core_kern_lskel(void) { struct core_kern_lskel *skel; int link_fd; skel = core_kern_lskel__open_and_load(); if (!ASSERT_OK_PTR(skel, "open_and_load")) return; link_fd = co...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_bpf_ma' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2023. Huawei Technologies Co., Ltd */ #define _GNU_SOURCE #include <sched.h> #include <pthread.h> #include <stdbool.h> #include <bpf/btf.h> #include <test_progs.h> #include "test_bpf_ma.skel.h" static void do_bpf_ma_test(const char *name) { struct test_bpf_ma...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/decap_sanity' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022 Meta Platforms, Inc. and affiliates. */ #include <sys/types.h> #include <sys/socket.h> #include <net/if.h> #include "test_progs.h" #include "network_helpers.h" #include "decap_sanity.skel.h" #define NS_TEST "decap_sanity_ns" #define IPV6_IFACE_ADDR "face...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/stacktrace_ips' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include "stacktrace_ips.skel.h" #ifdef __x86_64__ static int check_stacktrace_ips(int fd, __u32 key, int cnt, ...) { __u64 ips[PERF_MAX_STACK_DEPTH]; struct ksyms *ksyms = NULL; int i, err = 0; va_list args; /* sorted by addr */ ksyms = load_kall...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/cgrp_local_storage' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022 Meta Platforms, Inc. and affiliates.*/ #define _GNU_SOURCE #include <unistd.h> #include <sys/syscall.h> #include <sys/types.h> #include <test_progs.h> #include "cgrp_ls_tp_btf.skel.h" #include "cgrp_ls_recursion.skel.h" #include "cgrp_ls_attach_cgroup.skel...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/bpftool_metadata' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #include <bpftool_helpers.h> #include <test_progs.h> #include <linux/bpf.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #include <sys/stat.h> #include <stdbool.h> #define BPFFS_DIR "/sys/fs/bpf/test_metadata" #define BPFFS_USED BPFFS_DIR "/used" #define BPFF...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/core_retro' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2020 Facebook #define _GNU_SOURCE #include <test_progs.h> #include "test_core_retro.skel.h" void test_core_retro(void) { int err, zero = 0, res, my_pid = getpid(); struct test_core_retro *skel; /* load program */ skel = test_core_retro__open_and_load(); i...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/rbtree' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022 Meta Platforms, Inc. and affiliates. */ #include <test_progs.h> #include <network_helpers.h> #include "rbtree.skel.h" #include "rbtree_fail.skel.h" #include "rbtree_btf_fail__wrong_node_type.skel.h" #include "rbtree_btf_fail__add_wrong_type.skel.h" #inclu...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/linked_vars' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include <test_progs.h> #include <sys/syscall.h> #include "linked_vars.skel.h" void test_linked_vars(void) { int err; struct linked_vars *skel; skel = linked_vars__open(); if (!ASSERT_OK_PTR(skel, "skel_open")) return; skel->bss->inpu...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/sockopt' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include <io_uring/mini_liburing.h> #include "cgroup_helpers.h" static char bpf_log_buf[4096]; static bool verbose; #ifndef PAGE_SIZE #define PAGE_SIZE 4096 #endif enum sockopt_test_error { OK = 0, DENY_LOAD, DENY_ATTACH, EOPNOTSUPP_GETSOCKOPT, EP...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/xdp_noinline' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include <network_helpers.h> #include "test_xdp_noinline.skel.h" void test_xdp_noinline(void) { unsigned int nr_cpus = bpf_num_possible_cpus(); struct test_xdp_noinline *skel; struct vip key = {.protocol = 6}; struct vip_meta { __u32 flags; __u32...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/autoattach' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022 Google */ #include <test_progs.h> #include "test_autoattach.skel.h" void test_autoattach(void) { struct test_autoattach *skel; skel = test_autoattach__open_and_load(); if (!ASSERT_OK_PTR(skel, "skel_open_and_load")) goto cleanup; /* disable auto-a...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/sockopt_sk' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include "cgroup_helpers.h" #include <netinet/tcp.h> #include <linux/netlink.h> #include "sockopt_sk.skel.h" #ifndef SOL_TCP #define SOL_TCP IPPROTO_TCP #endif #define SOL_CUSTOM 0xdeadbeef static int getsetsockopt(void) { int fd, err; union { c...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/xdp_metadata' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include <network_helpers.h> #include "xdp_metadata.skel.h" #include "xdp_metadata2.skel.h" #include "xdp_metadata.h" #include "xsk.h" #include <bpf/btf.h> #include <linux/errqueue.h> #include <linux/if_link.h> #include <linux/net_tstamp.h> #include <net...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/sockmap_listen' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2020 Cloudflare /* * Test suite for SOCKMAP/SOCKHASH holding listening sockets. * Covers: * 1. BPF map operations - bpf_map_{update,lookup delete}_elem * 2. BPF redirect helpers - bpf_{sk,msg}_redirect_map * 3. BPF reuseport helper - bpf_sk_select_reusep...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/arg_parsing' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) #include "test_progs.h" #include "testing_helpers.h" static void init_test_filter_set(struct test_filter_set *set) { set->cnt = 0; set->tests = NULL; } static void free_test_filter_set(struct test_filter_set *set) { int i, j; for (i = 0; i < set->cnt; ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/xdp_adjust_tail' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include <network_helpers.h> static void test_xdp_adjust_tail_shrink(void) { const char *file = "./test_xdp_adjust_tail_shrink.bpf.o"; __u32 expect_sz; struct bpf_object *obj; int err, prog_fd; char buf[128]; LIBBPF_OPTS(bpf_test_run_opts, topts, ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/migrate_reuseport' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Check if we can migrate child sockets. * * 1. call listen() for 4 server sockets. * 2. call connect() for 25 client sockets. * 3. call listen() for 1 server socket. (migration target) * 4. update a map to migrate all child sockets * to the last server ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/cgroup_iter_memcg' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2025 Meta Platforms, Inc. and affiliates. */ #include <test_progs.h> #include <bpf/libbpf.h> #include <bpf/btf.h> #include <fcntl.h> #include <sys/mman.h> #include <unistd.h> #include "cgroup_helpers.h" #include "cgroup_iter_memcg.h" #include "cgroup_iter_memcg....
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_tc_edt' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* * BPF-based flow shaping * * The test brings up two veth in two isolated namespaces, attach some flow * shaping program onto it, and ensures that a manual speedtest maximum * value matches the rate set in the BPF shapers. */ #include <asm-generic/socke...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/kfunc_param_nullable' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 Meta Platforms, Inc */ #include <test_progs.h> #include "test_kfunc_param_nullable.skel.h" void test_kfunc_param_nullable(void) { RUN_TESTS(test_kfunc_param_nullable); } ```
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/skb_ctx' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include <network_helpers.h> void test_skb_ctx(void) { struct __sk_buff skb = { .cb[0] = 1, .cb[1] = 2, .cb[2] = 3, .cb[3] = 4, .cb[4] = 5, .priority = 6, .ingress_ifindex = 11, .ifindex = 1, .tstamp = 7, .wire_len = 100, .gso_segs...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/raw_tp_null' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ #include <test_progs.h> #include "raw_tp_null.skel.h" #include "raw_tp_null_fail.skel.h" void test_raw_tp_null(void) { struct raw_tp_null *skel; RUN_TESTS(raw_tp_null_fail); skel = raw_tp_null__open_and_load();...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/parse_tcp_hdr_opt' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #define _GNU_SOURCE #include <test_progs.h> #include <network_helpers.h> #include "test_parse_tcp_hdr_opt.skel.h" #include "test_parse_tcp_hdr_opt_dynptr.skel.h" #include "test_tcp_hdr_options.h" struct test_pkt { struct ipv6_packet pk6_v6; u8 options[16]; } __packed; struc...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/uninit_stack' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include "uninit_stack.skel.h" void test_uninit_stack(void) { RUN_TESTS(uninit_stack); } ```
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/trace_printk' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020, Oracle and/or its affiliates. */ #include <test_progs.h> #include "trace_printk.lskel.h" #define SEARCHMSG "testing,testing" #define SEARCHMSG_UTF8 "中文,测试" static void trace_pipe_cb(const char *str, void *data) { if (strstr(str, SEARCHMSG) != NULL) ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/bpf_loop' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include <test_progs.h> #include <network_helpers.h> #include "bpf_loop.skel.h" static void check_nr_loops(struct bpf_loop *skel) { struct bpf_link *link; link = bpf_program__attach(skel->progs.test_prog); if (!ASSERT_OK_PTR(link, "link"))...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_struct_ops_assoc' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include "struct_ops_assoc.skel.h" #include "struct_ops_assoc_reuse.skel.h" #include "struct_ops_assoc_in_timer.skel.h" static void test_st_ops_assoc(void) { struct struct_ops_assoc *skel = NULL; int err, pid; skel = struct_ops_assoc__open_and_load(...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/fexit_stress' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2019 Facebook */ #include <test_progs.h> #include "bpf_util.h" void serial_test_fexit_stress(void) { int bpf_max_tramp_links, err, i; int *fd, *fexit_fd, *link_fd; bpf_max_tramp_links = get_bpf_max_tramp_links(); if (!ASSERT_GE(bpf_max_tramp_links, 1, "bpf...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_mmap_inner_array' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ #include <test_progs.h> #include <sys/mman.h> #include "mmap_inner_array.skel.h" void test_mmap_inner_array(void) { const long page_size = sysconf(_SC_PAGE_SIZE); struct mmap_inner_array *skel; int inner_array_fd,...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/prog_tests/test_xsk' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ #ifndef TEST_XSK_H_ #define TEST_XSK_H_ #include <linux/ethtool.h> #include <linux/if_xdp.h> #include "../kselftest.h" #include "xsk.h" #ifndef SO_PREFER_BUSY_POLL #define SO_PREFER_BUSY_POLL 69 #endif #ifndef SO_BUSY_POLL_BUDGET #define SO_BUSY_POLL_BUDGET 70 #endif #de...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/btf_permute' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2026 Xiaomi */ #include <test_progs.h> #include <bpf/btf.h> #include "btf_helpers.h" static void permute_base_check(struct btf *btf) { VALIDATE_RAW_BTF( btf, "[1] STRUCT 's2' size=4 vlen=1\n" "\t'm' type_id=4 bits_offset=0", "[2] FUNC 'f' type_id=6 li...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/stacktrace_build_id' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include "test_stacktrace_build_id.skel.h" void test_stacktrace_build_id(void) { int control_map_fd, stackid_hmap_fd, stackmap_fd, stack_amap_fd; struct test_stacktrace_build_id *skel; int err, stack_trace_len, build_id_size; __u32 key, prev_key, va...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/get_func_args_test' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include "get_func_args_test.skel.h" #include "get_func_args_fsession_test.skel.h" void test_get_func_args_test(void) { struct get_func_args_test *skel = NULL; int err, prog_fd; LIBBPF_OPTS(bpf_test_run_opts, topts); skel = get_func_args_test__open_...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/cgroup_hierarchical_stats' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * This test makes sure BPF stats collection using rstat works correctly. * The test uses 3 BPF progs: * (a) counter: This BPF prog is invoked every time we attach a process to a * cgroup and locklessly increments a percpu counter. * The pro...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/preempt_lock' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include <network_helpers.h> #include <preempt_lock.skel.h> void test_preempt_lock(void) { RUN_TESTS(preempt_lock); } ```
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/btf_endian' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #define _GNU_SOURCE #include <string.h> #include <byteswap.h> #include <test_progs.h> #include <bpf/btf.h> void test_btf_endian() { #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ enum btf_endianness endian = BTF_LITTLE_ENDIAN; #elif __BYTE_ORDE...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/cgroup_ancestor' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "test_progs.h" #include "network_helpers.h" #include "cgroup_helpers.h" #include "cgroup_ancestor.skel.h" #define CGROUP_PATH "/skb_cgroup_test" #define TEST_NS "cgroup_ancestor_ns" #define NUM_CGROUP_LEVELS 4 #define WAIT_AUTO_IP_MAX_ATTEMPT 10 #define DST_ADDR "::1"...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/kernel_flag' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2025 Microsoft */ #include <test_progs.h> #include "kfunc_call_test.skel.h" #include "kfunc_call_test.lskel.h" #include "test_kernel_flag.skel.h" void test_kernel_flag(void) { struct test_kernel_flag *lsm_skel; struct kfunc_call_test *skel = NULL; struct kfu...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/trace_ext' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #define _GNU_SOURCE #include <test_progs.h> #include <network_helpers.h> #include <sys/stat.h> #include <linux/sched.h> #include <sys/syscall.h> #include "test_pkt_md_access.skel.h" #include "test_trace_ext.skel.h" #include "test_trace_ext_tracing.skel.h" static __u32 duratio...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/map_ptr' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2020 Facebook #include <test_progs.h> #include <network_helpers.h> #include "map_ptr_kern.lskel.h" void test_map_ptr(void) { struct map_ptr_kern_lskel *skel; char buf[128]; int err; int page_size = getpagesize(); LIBBPF_OPTS(bpf_test_run_opts, topts, ....
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/uprobe' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Hengqi Chen */ #include <test_progs.h> #include <asm/ptrace.h> #include "test_uprobe.skel.h" static FILE *urand_spawn(int *pid) { FILE *f; /* urandom_read's stdout is wired into f */ f = popen("./urandom_read 1 report-pid", "r"); if (!f) return NUL...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/uprobe_syscall' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #ifdef __x86_64__ #include <unistd.h> #include <asm/ptrace.h> #include <linux/compiler.h> #include <linux/stringify.h> #include <linux/kernel.h> #include <sys/wait.h> #include <sys/syscall.h> #include <sys/prctl.h> #include <asm/prctl.h> #include "upro...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/rdonly_maps' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> struct bss { unsigned did_run; unsigned iters; unsigned sum; }; struct rdonly_map_subtest { const char *subtest_name; const char *prog_name; unsigned exp_iters; unsigned exp_sum; }; void test_rdonly_maps(void) { const char *file = "test_rdonly_...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/perf_event_stackmap' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2020 Facebook #define _GNU_SOURCE #include <pthread.h> #include <sched.h> #include <test_progs.h> #include "perf_event_stackmap.skel.h" #ifndef noinline #define noinline __attribute__((noinline)) #endif noinline int func_1(void) { static int val = 1; val +=...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/mmap' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include <sys/mman.h> #include "test_mmap.skel.h" struct map_data { __u64 val[512 * 4]; }; static size_t roundup_page(size_t sz) { long page_size = sysconf(_SC_PAGE_SIZE); return (sz + page_size - 1) / page_size * page_size; } void test_mmap(void) {...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/cls_redirect' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause // Copyright (c) 2020 Cloudflare #define _GNU_SOURCE #include <arpa/inet.h> #include <string.h> #include <linux/pkt_cls.h> #include <netinet/tcp.h> #include <test_progs.h> #include "network_helpers.h" #include "progs/test_cls_redirect.h" #include "test_cls_r...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/recursion' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include <test_progs.h> #include "recursion.skel.h" void test_recursion(void) { struct bpf_prog_info prog_info = {}; __u32 prog_info_len = sizeof(prog_info); struct recursion *skel; int key = 0; int err; skel = recursion__open_and_load()...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_strncmp' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2021. Huawei Technologies Co., Ltd */ #include <test_progs.h> #include "strncmp_test.skel.h" static int trigger_strncmp(const struct strncmp_test *skel) { int cmp; usleep(1); cmp = skel->bss->cmp_ret; if (cmp > 0) return 1; if (cmp < 0) return -1; r...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/varlen' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include <test_progs.h> #include <time.h> #include "test_varlen.skel.h" #define CHECK_VAL(got, exp) \ CHECK((got) != (exp), "check", "got %ld != exp %ld\n", \ (long)(got), (long)(exp)) void test_varlen(void) { int duration = 0, err; ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/prog_tests_framework' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) #include "test_progs.h" #include "testing_helpers.h" static void clear_test_state(struct test_state *state) { state->error_cnt = 0; state->sub_succ_cnt = 0; state->skip_cnt = 0; } void test_prog_tests_framework(void) { struct test_state *state = env.tes...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/sockmap_strp' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <error.h> #include <netinet/tcp.h> #include <test_progs.h> #include "sockmap_helpers.h" #include "test_skmsg_load_helpers.skel.h" #include "test_sockmap_strp.skel.h" #define STRP_PKT_HEAD_LEN 4 #define STRP_PKT_BODY_LEN 6 #define STRP_PKT_FULL_LEN (STRP_PKT_HEAD_LEN + ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/xfrm_info' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* * Topology: * --------- * NS0 namespace | NS1 namespace | NS2 namespace * | | * +---------------+ | +---------------+ | * | ipsec0 |---------| ipsec0 | | * ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/module_attach' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include <test_progs.h> #include <stdbool.h> #include "test_module_attach.skel.h" #include "testing_helpers.h" static const char * const read_tests[] = { "handle_raw_tp", "handle_tp_btf", "handle_fentry", "handle_fentry_explicit", "handle...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/helper_restricted' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include "test_helper_restricted.skel.h" void test_helper_restricted(void) { int prog_i = 0, prog_cnt; do { struct test_helper_restricted *test; int err; test = test_helper_restricted__open(); if (!ASSERT_OK_PTR(test, "open")) return; ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include "cgroup_helpers.h" #define PING_CMD "ping -q -c1 -w1 127.0.0.1 > /dev/null" static char bpf_log_buf[BPF_LOG_BUF_SIZE]; static int map_fd = -1; static int prog_load_cnt(int verdict, int val) { int cgroup_storage_fd, percpu_cgroup_storage_fd...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/raw_tp_writable_test_run' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include <linux/nbd.h> #include "bpf_util.h" /* NOTE: conflict with other tests. */ void serial_test_raw_tp_writable_test_run(void) { __u32 duration = 0; char error[4096]; const struct bpf_insn trace_program[] = { BPF_LDX_MEM(BPF_DW, BPF_REG_6, BP...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/select_reuseport' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2018 Facebook */ #include <stdlib.h> #include <unistd.h> #include <stdbool.h> #include <string.h> #include <errno.h> #include <assert.h> #include <fcntl.h> #include <linux/bpf.h> #include <linux/err.h> #include <linux/types.h> #include <linux/if_ether.h> #inclu...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/cpumask' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */ #include <test_progs.h> #include "cpumask_failure.skel.h" #include "cpumask_success.skel.h" static const char * const cpumask_success_testcases[] = { "test_alloc_free_cpumask", "test_set_clear_cpu", "test_setall_...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/xdp_devmap_attach' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <arpa/inet.h> #include <uapi/linux/bpf.h> #include <linux/if_link.h> #include <network_helpers.h> #include <net/if.h> #include <test_progs.h> #include "test_xdp_devmap_helpers.skel.h" #include "test_xdp_devmap_tailcall.skel.h" #include "test_xdp_with_devmap_frags_helpe...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/xdp_link' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include <uapi/linux/if_link.h> #include <test_progs.h> #include "test_xdp_link.skel.h" #define IFINDEX_LO 1 void serial_test_xdp_link(void) { struct test_xdp_link *skel1 = NULL, *skel2 = NULL; __u32 id1, id2, id0 = 0, prog_fd1, prog_fd2; L...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/btf' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* SPDX-License-Identifier: GPL-2.0 */ /* Copyright (c) 2018 Facebook */ #include <linux/bpf.h> #include <linux/btf.h> #include <linux/err.h> #include <linux/kernel.h> #include <linux/filter.h> #include <linux/unistd.h> #include <bpf/bpf.h> #include <libelf.h> #include <gelf.h> #include <string.h> #include <stdli...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_xsk' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <bpf/bpf.h> #include <errno.h> #include <linux/bitmap.h> #include <linux/if_link.h> #include <linux/mman.h> #include <linux/netdev.h> #include <poll.h> #include <pthread.h> #include <signal.h> #include <string.h> #include <sys/mman.h> #include <sys/socket.h> #include <s...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/connect_force_port' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include "cgroup_helpers.h" #include "network_helpers.h" static int verify_ports(int family, int fd, __u16 expected_local, __u16 expected_peer) { struct sockaddr_storage addr; socklen_t len = sizeof(addr); __u16 port; if (getsockname(fd, (struct...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/timer_lockup' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #define _GNU_SOURCE #include <sched.h> #include <test_progs.h> #include <pthread.h> #include <network_helpers.h> #include <sys/sysinfo.h> #include "timer_lockup.skel.h" static long cpu; static int *timer1_err; static int *timer2_err; static bool skip; volatile int k = 0; st...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/find_vma' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include <test_progs.h> #include <sys/types.h> #include <unistd.h> #include "find_vma.skel.h" #include "find_vma_fail1.skel.h" #include "find_vma_fail2.skel.h" static void test_and_reset_skel(struct find_vma *skel, int expected_find_zero_ret, b...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/link_pinning' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include <test_progs.h> #include <sys/stat.h> #include "test_link_pinning.skel.h" static int duration = 0; void test_link_pinning_subtest(struct bpf_program *prog, struct test_link_pinning__bss *bss) { const char *link_pin_path = ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/sockmap_basic' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2020 Cloudflare #include <error.h> #include <linux/tcp.h> #include <linux/socket.h> #include <sys/epoll.h> #include "test_progs.h" #include "test_skmsg_load_helpers.skel.h" #include "test_sockmap_update.skel.h" #include "test_sockmap_invalid_update.skel.h" #inc...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/hash_large_key' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include "test_hash_large_key.skel.h" void test_hash_large_key(void) { int err, value = 21, duration = 0, hash_map_fd; struct test_hash_large_key *skel; struct bigelement { int a; char b[4096]; long long c; } key; bzero(&key, sizeof(key)); ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/skb_helpers' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include <network_helpers.h> void test_skb_helpers(void) { struct __sk_buff skb = { .wire_len = 100, .gso_segs = 8, .gso_size = 10, }; LIBBPF_OPTS(bpf_test_run_opts, topts, .data_in = &pkt_v4, .data_size_in = sizeof(pkt_v4), .ctx_in = &skb...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_profiler' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include <test_progs.h> #include "progs/profiler.h" #include "profiler1.skel.h" #include "profiler2.skel.h" #include "profiler3.skel.h" static int sanity_run(struct bpf_program *prog) { LIBBPF_OPTS(bpf_test_run_opts, test_attr); __u64 args[] ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/tracing_failure' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ #include <test_progs.h> #include "tracing_failure.skel.h" static void test_bpf_spin_lock(bool is_spin_lock) { struct tracing_failure *skel; int err; skel = tracing_failure__open(); if (!ASSERT_OK_PTR(skel, "trac...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/arena_htab' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ #include <test_progs.h> #include <sys/mman.h> #include <network_helpers.h> #include <sys/user.h> #ifndef PAGE_SIZE /* on some archs it comes in sys/user.h */ #include <unistd.h> #define PAGE_SIZE getpagesize() #endif ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #define _GNU_SOURCE #include <pthread.h> #include <sched.h> #include <sys/socket.h> #include <test_progs.h> #define MAX_CNT_RAWTP 10ull #define MAX_STACK_RAWTP 100 static int duration = 0; struct get_stack_trace_t { int pid; int kern_stack_size; int user_stack_size; int u...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/fentry_fexit' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2019 Facebook */ #include <test_progs.h> #include "fentry_test.lskel.h" #include "fexit_test.lskel.h" void test_fentry_fexit(void) { struct fentry_test_lskel *fentry_skel = NULL; struct fexit_test_lskel *fexit_skel = NULL; __u64 *fentry_res, *fexit_res; int...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/fd_htab_lookup' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2025. Huawei Technologies Co., Ltd */ #define _GNU_SOURCE #include <stdbool.h> #include <test_progs.h> #include "fd_htab_lookup.skel.h" struct htab_op_ctx { int fd; int loop; unsigned int entries; bool stop; }; #define ERR_TO_RETVAL(where, err) ((void *)(l...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/bpf_obj_pinning' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */ #define _GNU_SOURCE #include <test_progs.h> #include <bpf/btf.h> #include <fcntl.h> #include <unistd.h> #include <linux/unistd.h> #include <linux/mount.h> #include <sys/syscall.h> #include "bpf/libbpf_internal.h" sta...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/refcounted_kptr' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */ #include <test_progs.h> #include <network_helpers.h> #include "refcounted_kptr.skel.h" #include "refcounted_kptr_fail.skel.h" void test_refcounted_kptr(void) { RUN_TESTS(refcounted_kptr); } void test_refcounted_k...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/cgroup_xattr' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2025 Meta Platforms, Inc. and affiliates. */ #include <errno.h> #include <fcntl.h> #include <sys/stat.h> #include <string.h> #include <unistd.h> #include <sys/socket.h> #include <test_progs.h> #include "cgroup_helpers.h" #include "read_cgroupfs_xattr.skel...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/verif_stats' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include <test_progs.h> #include "trace_vprintk.lskel.h" void test_verif_stats(void) { __u32 len = sizeof(struct bpf_prog_info); struct trace_vprintk_lskel *skel; struct bpf_prog_info info = {}; int err; skel = trace_vprintk_lskel__open...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/libbpf_get_fd_by_id_opts' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2022 Huawei Technologies Duesseldorf GmbH * * Author: Roberto Sassu <roberto.sassu@huawei.com> */ #include <test_progs.h> #include "test_libbpf_get_fd_by_id_opts.skel.h" void test_libbpf_get_fd_by_id_opts(void) { struct test_libbpf_get_fd_by_id_opts *...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/reg_bounds' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */ #define _GNU_SOURCE #include <limits.h> #include <test_progs.h> #include <linux/filter.h> #include <linux/bpf.h> /* ================================= * SHORT AND CONSISTENT NUMBER TYPES * =========================...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/kprobe_multi_test' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <sys/prctl.h> #include <test_progs.h> #include "kprobe_multi.skel.h" #include "trace_helpers.h" #include "kprobe_multi_empty.skel.h" #include "kprobe_multi_override.skel.h" #include "kprobe_multi_session.skel.h" #include "kprobe_multi_session_cookie.s...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/task_kfunc' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022 Meta Platforms, Inc. and affiliates. */ #define _GNU_SOURCE #include <sys/wait.h> #include <test_progs.h> #include <unistd.h> #include "task_kfunc_failure.skel.h" #include "task_kfunc_success.skel.h" static struct task_kfunc_success *open_load_task_kfunc...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/prog_tests/sockmap_helpers' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c #ifndef __SOCKMAP_HELPERS__ #define __SOCKMAP_HELPERS__ #include "socket_helpers.h" #define MAX_TEST_NAME 80 #define u32(v) ((u32){(v)}) #define u64(v) ((u64){(v)}) #define __always_unused __attribute__((__unused__)) #define xbpf_map_delete_elem(fd, key) \ ({ ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/verify_pkcs7_sig' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2022 Huawei Technologies Duesseldorf GmbH * * Author: Roberto Sassu <roberto.sassu@huawei.com> */ #include <stdio.h> #include <errno.h> #include <stdlib.h> #include <unistd.h> #include <endian.h> #include <limits.h> #include <sys/stat.h> #include <sys/wa...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/map_in_map' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2023. Huawei Technologies Co., Ltd */ #define _GNU_SOURCE #include <unistd.h> #include <sys/syscall.h> #include <test_progs.h> #include <bpf/btf.h> #include "access_map_in_map.skel.h" #include "update_map_in_htab.skel.h" struct thread_ctx { pthread_barrier_t ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/wq' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 Benjamin Tissoires */ #include <test_progs.h> #include "wq.skel.h" #include "wq_failures.skel.h" void serial_test_wq(void) { struct wq *wq_skel = NULL; int err, prog_fd; LIBBPF_OPTS(bpf_test_run_opts, topts); RUN_TESTS(wq); /* re-run the success te...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/bpf_mod_race' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <unistd.h> #include <pthread.h> #include <sys/mman.h> #include <stdatomic.h> #include <test_progs.h> #include <sys/syscall.h> #include <linux/module.h> #include <linux/userfaultfd.h> #include "ksym_race.skel.h" #include "bpf_mod_race.skel.h" #include "kfunc_call_race.s...