instruction
stringlengths
82
202
input
stringclasses
1 value
output
stringlengths
73
23.9M
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/dynptr' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022 Facebook */ #include <test_progs.h> #include <network_helpers.h> #include "dynptr_fail.skel.h" #include "dynptr_success.skel.h" enum test_setup_type { SETUP_SYSCALL_SLEEP, SETUP_SKB_PROG, SETUP_SKB_PROG_TP, SETUP_XDP_PROG, }; static struct { const c...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/xdp_context_test_run' 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_context_test_run.skel.h" #include "test_xdp_meta.skel.h" #define RX_NAME "veth0" #define TX_NAME "veth1" #define TX_NETNS "xdp_context_tx" #define RX_NETNS "xdp_context_rx" #define TAP_NAME "tap0" #define D...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/netns_cookie' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include "netns_cookie_prog.skel.h" #include "network_helpers.h" #ifndef SO_NETNS_COOKIE #define SO_NETNS_COOKIE 71 #endif #define loopback 1 static int duration; void test_netns_cookie(void) { LIBBPF_OPTS(bpf_prog_attach_opts, opta); LIBBPF_OPTS(b...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/sockmap_ktls' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2020 Cloudflare /* * Tests for sockmap/sockhash holding kTLS sockets. */ #include <error.h> #include <netinet/tcp.h> #include <linux/tls.h> #include "test_progs.h" #include "sockmap_helpers.h" #include "test_skmsg_load_helpers.skel.h" #include "test_sockmap_kt...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/task_under_cgroup' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Bytedance */ #include <sys/syscall.h> #include <test_progs.h> #include <cgroup_helpers.h> #include "test_task_under_cgroup.skel.h" #define FOO "/foo" void test_task_under_cgroup(void) { struct test_task_under_cgroup *skel; int ret, foo; pid_t pid; f...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/ptr_untrusted' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2023 Yafang Shao <laoar.shao@gmail.com> */ #include <string.h> #include <linux/bpf.h> #include <test_progs.h> #include "test_ptr_untrusted.skel.h" #define TP_NAME "sched_switch" void serial_test_ptr_untrusted(void) { struct test_ptr_untrusted *skel; int err...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/netcnt' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <sys/sysinfo.h> #include <test_progs.h> #include "network_helpers.h" #include "netcnt_prog.skel.h" #include "netcnt_common.h" #define CG_NAME "/netcnt" void serial_test_netcnt(void) { union percpu_net_cnt *percpu_netcnt = NULL; struct bpf_cgroup_storage_key key; i...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/hashmap' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) /* * Tests for libbpf's hashmap. * * Copyright (c) 2019 Facebook */ #include "test_progs.h" #include "bpf/hashmap.h" #include <stddef.h> static int duration = 0; static size_t hash_fn(long k, void *ctx) { return k; } static bool equal_fn(long a, long ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/pinning_htab' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include "test_pinning_htab.skel.h" static void unpin_map(const char *map_name, const char *pin_path) { struct test_pinning_htab *skel; struct bpf_map *map; int err; skel = test_pinning_htab__open_and_load(); if (!ASSERT_OK_PTR(skel, "skel open_an...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/snprintf' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Google LLC. */ #include <test_progs.h> #include "test_snprintf.skel.h" #include "test_snprintf_single.skel.h" #define EXP_NUM_OUT "-8 9 96 -424242 1337 DABBAD00" #define EXP_NUM_RET sizeof(EXP_NUM_OUT) #define EXP_IP_OUT "127.000.000.001 0000:0000:00...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/prog_tests/tc_helpers' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ /* Copyright (c) 2023 Isovalent */ #ifndef TC_HELPERS #define TC_HELPERS #include <test_progs.h> #ifndef loopback # define loopback 1 #endif static inline __u32 ifindex_from_link_fd(int fd) { struct bpf_link_info link_info = {}; __u32 link_info_len = sizeof(link_info); i...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/res_spin_lock' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024-2025 Meta Platforms, Inc. and affiliates. */ #include <test_progs.h> #include <network_helpers.h> #include <sys/sysinfo.h> #include "res_spin_lock.skel.h" #include "res_spin_lock_fail.skel.h" void test_res_spin_lock_failure(void) { RUN_TESTS(res_spin_loc...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/sock_destroy' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include <bpf/bpf_endian.h> #include "sock_destroy_prog.skel.h" #include "sock_destroy_prog_fail.skel.h" #include "network_helpers.h" #define TEST_NS "sock_destroy_netns" static void start_iter_sockets(struct bpf_program *prog) { struct bpf_link *link...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/xdpwall' 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 "xdpwall.skel.h" void test_xdpwall(void) { struct xdpwall *skel; skel = xdpwall__open_and_load(); ASSERT_OK_PTR(skel, "Does LLVM have https://github.com/llvm/llvm-project/commit/ea72b0319d7b0f0c2fcf41d121af...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/lru_bug' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include "lru_bug.skel.h" void test_lru_bug(void) { struct lru_bug *skel; int ret; skel = lru_bug__open_and_load(); if (!ASSERT_OK_PTR(skel, "lru_bug__open_and_load")) return; ret = lru_bug__attach(skel); if (!ASSERT_OK(ret, "lru_bug__attach"))...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/map_kptr_race' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2026 Meta Platforms, Inc. and affiliates. */ #include <test_progs.h> #include <network_helpers.h> #include "map_kptr_race.skel.h" static int get_map_id(int map_fd) { struct bpf_map_info info = {}; __u32 len = sizeof(info); if (!ASSERT_OK(bpf_map_get_info_b...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/bpf_verif_scale' 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> static int libbpf_debug_print(enum libbpf_print_level level, const char *format, va_list args) { if (level != LIBBPF_DEBUG) { vprintf(format, args); return 0; } if (!strstr(format, "verifier log")) return ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/usdt' 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> #define _SDT_HAS_SEMAPHORES 1 #include "../sdt.h" #include "test_usdt.skel.h" #include "test_urandom_usdt.skel.h" int lets_test_this(int); static volatile int idx = 2; static volatile __u64...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/tracing_struct' 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 "tracing_struct.skel.h" #include "tracing_struct_many_args.skel.h" static void test_struct_args(void) { struct tracing_struct *skel; int err; skel = tracing_struct__open_and_load...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/type_cast' 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 "type_cast.skel.h" static void test_xdp(void) { struct type_cast *skel; int err, prog_fd; char buf[128]; LIBBPF_OPTS(bpf_test_run_opts, topts, .dat...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/map_init' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2020 Tessares SA <http://www.tessares.net> */ #include <test_progs.h> #include "test_map_init.skel.h" #define TEST_VALUE 0x1234 #define FILL_VALUE 0xdeadbeef static int nr_cpus; static int duration; typedef unsigned long long map_key_t; typedef unsigned...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/xdp_bpf2bpf' 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 "test_xdp.skel.h" #include "test_xdp_bpf2bpf.skel.h" struct meta { int ifindex; int pkt_len; }; struct test_ctx_s { bool passed; int pkt_size; }; struct test_ctx_s test_ctx; static void on_...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/string_kfuncs' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2025 Red Hat, Inc.*/ #include <test_progs.h> #include "string_kfuncs_success.skel.h" #include "string_kfuncs_failure1.skel.h" #include "string_kfuncs_failure2.skel.h" #include <sys/mman.h> static const char * const test_cases[] = { "strcmp", "strcasecmp", "s...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_ima' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2020 Google LLC. */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/wait.h> #include <test_progs.h> #include <linux/ring_buffer.h> #include "ima.skel.h" #define MAX_SAMPLES 4 static int _run_measured_process(const char *measured...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/tc_change_tail' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <error.h> #include <test_progs.h> #include <linux/pkt_cls.h> #include "test_tc_change_tail.skel.h" #include "socket_helpers.h" #define LO_IFINDEX 1 void test_tc_change_tail(void) { LIBBPF_OPTS(bpf_tcx_opts, tcx_opts); struct test_tc_change_tail *skel = NULL; struc...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/xdp_perf' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> void test_xdp_perf(void) { const char *file = "./xdp_dummy.bpf.o"; struct bpf_object *obj; char in[128], out[128]; int err, prog_fd; LIBBPF_OPTS(bpf_test_run_opts, topts, .data_in = in, .data_size_in = sizeof(in), .data_out = out, .data_size...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/core_extern' 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 <sys/mman.h> #include <sys/utsname.h> #include <linux/version.h> #include "test_core_extern.skel.h" static uint32_t get_kernel_version(void) { uint32_t major, minor, patch; struct utsname info; uname(&info)...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/sockopt_qos_to_cc' 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 <netinet/tcp.h> #include "sockopt_qos_to_cc.skel.h" static void run_setsockopt_test(int cg_fd, int sock_fd) { socklen_t optlen; char cc[16]; /* TCP_CA_NAME_MAX */ int buf; int err = -1; buf = 0x2D; err = ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/signal_pending' 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 sigalrm_handler(int s) {} static struct sigaction sigalrm_action = { .sa_handler = sigalrm_handler, }; static void test_signal_pending_by_type(enum bpf_prog_type prog_type) { struct bpf_insn prog[4096]; struct...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/global_data' 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_global_data_number(struct bpf_object *obj, __u32 duration) { int i, err, map_fd; __u64 num; map_fd = bpf_find_map(__func__, obj, "result_number"); if (CHECK_FAIL(map_fd < 0)) return; struct { char ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/xdp_dev_bound_only' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <net/if.h> #include <test_progs.h> #include <network_helpers.h> #define LOCAL_NETNS "xdp_dev_bound_only_netns" static int load_dummy_prog(char *name, __u32 ifindex, __u32 flags) { struct bpf_insn insns[] = { BPF_MOV64_IMM(BPF_REG_0, 0), BPF_EXIT_INSN() }; LIBBPF_OPT...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/user_ringbuf' 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 <linux/compiler.h> #include <linux/ring_buffer.h> #include <linux/build_bug.h> #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <sys/mman.h> #include <sys/syscall.h> #...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/lookup_key' 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 <linux/keyctl.h> #include <test_progs.h> #include "test_lookup_key.skel.h" #define KEY_LOOKUP_CREATE 0x01 #define KEY_LOOKUP_PARTIAL 0x02 static...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/skb_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> #include "skb_load_bytes.skel.h" void test_skb_load_bytes(void) { struct skb_load_bytes *skel; int err, prog_fd, test_result; struct __sk_buff skb = { 0 }; LIBBPF_OPTS(bpf_test_run_opts, tattr, .data_in = &pkt_v4, .d...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/module_fentry_shadow' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022 Red Hat */ #include <test_progs.h> #include <bpf/btf.h> #include "bpf/libbpf_internal.h" #include "cgroup_helpers.h" #include "bpf_util.h" static const char *module_name = "bpf_testmod"; static const char *symbol_name = "bpf_fentry_shadow_test"; static in...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/trampoline_count' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #define _GNU_SOURCE #include <test_progs.h> struct inst { struct bpf_object *obj; struct bpf_link *link; }; static struct bpf_program *load_prog(char *file, char *name, struct inst *inst) { struct bpf_object *obj; struct bpf_program *prog; int err; obj = bpf_obje...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/sk_lookup' 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 /* * Test BPF attach point for INET socket lookup (BPF_SK_LOOKUP). * * Tests exercise: * - attaching/detaching/querying programs to BPF_SK_LOOKUP hook, * - redirecting socket lookup to a socket selected by BPF program, * ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/cgroup_mprog_opts' 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 "cgroup_helpers.h" #include "cgroup_mprog.skel.h" static void assert_mprog_count(int cg, int atype, int expected) { __u32 count = 0, attach_flags = 0; int err; err = bpf_prog_quer...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/sockopt_inherit' 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" #include "sockopt_inherit.skel.h" #define SOL_CUSTOM 0xdeadbeef #define CUSTOM_INHERIT1 0 #define CUSTOM_INHERIT2 1 #define CUSTOM_LISTENER 2 static int verify_sockopt(int fd, int optname...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/timer' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include <sched.h> #include <test_progs.h> #include <linux/perf_event.h> #include <sys/syscall.h> #include "timer.skel.h" #include "timer_failure.skel.h" #include "timer_interrupt.skel.h" #define NUM_THR 8 static int perf_event_open(__u32 type...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/linked_list' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <bpf/btf.h> #include <test_btf.h> #include <linux/btf.h> #include <test_progs.h> #include <network_helpers.h> #include "linked_list.skel.h" #include "linked_list_fail.skel.h" #include "linked_list_peek.skel.h" static char log_buf[1024 * 1024]; static struct { const ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/pe_preserve_elems' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2019 Facebook */ #include <test_progs.h> #include <linux/bpf.h> #include "test_pe_preserve_elems.skel.h" static int duration; static void test_one_map(struct bpf_map *map, struct bpf_program *prog, bool has_share_pe) { int err, key = 0, pfd = -1, mfd...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/uprobe_multi_test' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <unistd.h> #include <pthread.h> #include <test_progs.h> #include "uprobe_multi.skel.h" #include "uprobe_multi_bench.skel.h" #include "uprobe_multi_usdt.skel.h" #include "uprobe_multi_consumers.skel.h" #include "uprobe_multi_pid_filter.skel.h" #include "uprobe_multi_ses...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/ringbuf' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #define _GNU_SOURCE #include <linux/compiler.h> #include <asm/barrier.h> #include <test_progs.h> #include <sys/mman.h> #include <sys/epoll.h> #include <time.h> #include <sched.h> #include <signal.h> #include <pthread.h> #include <sys/sysinfo.h> #include <linux/perf_event.h> #inc...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/bpf_qdisc' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/pkt_sched.h> #include <linux/rtnetlink.h> #include <test_progs.h> #include "network_helpers.h" #include "bpf_qdisc_fifo.skel.h" #include "bpf_qdisc_fq.skel.h" #include "bpf_qdisc_fail__incompl_ops.skel.h" #define LO_IFINDEX 1 static const unsigned int total_b...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/htab_update' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2022. Huawei Technologies Co., Ltd */ #define _GNU_SOURCE #include <sched.h> #include <stdbool.h> #include <test_progs.h> #include "htab_update.skel.h" struct htab_update_ctx { int fd; int loop; bool stop; }; static void test_reenter_update(void) { struct ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/map_btf' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2023. Huawei Technologies Co., Ltd */ #include <test_progs.h> #include "normal_map_btf.skel.h" #include "map_in_map_btf.skel.h" static void do_test_normal_map_btf(void) { struct normal_map_btf *skel; int i, err, new_fd = -1; int map_fd_arr[64]; skel = nor...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/trace_vprintk' 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" #define SEARCHMSG "1,2,3,4,5,6,7,8,9,10" static void trace_pipe_cb(const char *str, void *data) { if (strstr(str, SEARCHMSG) != NULL) (*(int *)data)++; } void serial_test_trace_vpr...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_tc_tunnel' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* * End-to-end eBPF tunnel test suite * The file tests BPF network tunnels implementation. For each tunnel * type, the test validates that: * - basic communication can first be established between the two veths * - when adding a BPF-based encapsula...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_lsm' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2020 Google LLC. */ #include <test_progs.h> #include <sys/mman.h> #include <sys/wait.h> #include <unistd.h> #include <malloc.h> #include <stdlib.h> #include "lsm.skel.h" #include "lsm_tailcall.skel.h" char *CMD_ARGS[] = {"true", NULL}; #define GET_PAGE_...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/perf_link' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #define _GNU_SOURCE #include <linux/compiler.h> #include <test_progs.h> #include "testing_helpers.h" #include "test_perf_link.skel.h" #define BURN_TIMEOUT_MS 100 #define BURN_TIMEOUT_NS BURN_TIMEOUT_MS * 1000000 static void burn_cpu(void) { i...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_dst_clear' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2026 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 "test_dst_clear.skel.h" #define IPV4_IFACE_ADDR "1.0.0.1" #define UDP_TEST_PORT 7777 ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/htab_reuse' 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 <stdbool.h> #include <test_progs.h> #include "htab_reuse.skel.h" struct htab_op_ctx { int fd; int loop; bool stop; }; struct htab_val { unsigned int lock; unsigned int d...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/time_tai' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2022 Linutronix GmbH */ #include <test_progs.h> #include <network_helpers.h> #include "test_time_tai.skel.h" #include <time.h> #include <stdint.h> #define TAI_THRESHOLD 1000000000ULL /* 1s */ #define NSEC_PER_SEC 1000000000ULL static __u64 ts_to_ns(const st...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/fd_array' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include <linux/btf.h> #include <bpf/bpf.h> #include "../test_btf.h" static inline int new_map(void) { const char *name = NULL; __u32 max_entries = 1; __u32 value_size = 8; __u32 key_size = 4; return bpf_map_create(BPF_MAP_TYPE_ARRAY, name, ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/metadata' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * Copyright 2020 Google LLC. */ #include <test_progs.h> #include <cgroup_helpers.h> #include <network_helpers.h> #include "metadata_unused.skel.h" #include "metadata_used.skel.h" static int duration; static int prog_holds_map(int prog_fd, int map_fd) { struct bpf...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/rcu_read_lock' 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 <bpf/btf.h> #include "rcu_read_lock.skel.h" #include "cgroup_helpers.h" static unsigned long lo...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/xdp_pull_data' 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_pull_data.skel.h" #define PULL_MAX (1 << 31) #define PULL_PLUS_ONE (1 << 30) #define XDP_PACKET_HEADROOM 256 /* Find headroom and tailroom occupied by struct xdp_frame and struct * skb_shared_info so th...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/token' 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 <bpf/btf.h> #include <fcntl.h> #include <sched.h> #include <signal.h> #include <unistd.h> #include <linux/filter.h> #include <linux/unistd.h> #include <linux/mount.h> #include <sys/socket....
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/global_map_resize' 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 <errno.h> #include <sys/syscall.h> #include <unistd.h> #include "test_global_map_resize.skel.h" #include "test_progs.h" static void run_prog_bss_array_sum(void) { (void)syscall(__NR_getpid); } static void ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/timer_start_deadlock' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2026 Meta Platforms, Inc. and affiliates. */ #include <test_progs.h> #include "timer_start_deadlock.skel.h" void test_timer_start_deadlock(void) { struct timer_start_deadlock *skel; int err, prog_fd; LIBBPF_OPTS(bpf_test_run_opts, opts); skel = timer_start...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/tc_bpf' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include <linux/pkt_cls.h> #include "cap_helpers.h" #include "test_tc_bpf.skel.h" #define LO_IFINDEX 1 #define TEST_DECLARE_OPTS(__fd) \ DECLARE_LIBBPF_OPTS(bpf_tc_opts, opts_h, .handl...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/jeq_infer_not_null' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include "jeq_infer_not_null_fail.skel.h" void test_jeq_infer_not_null(void) { RUN_TESTS(jeq_infer_not_null_fail); } ```
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/perf_skip' 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 "test_perf_skip.skel.h" #include <linux/compiler.h> #include <linux/hw_breakpoint.h> #include <sys/mman.h> #ifndef TRAP_PERF #define TRAP_PERF 6 #endif int sigio_count, sigtrap_count; static void handle_sigio(int sig __alw...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/linked_funcs' 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_funcs.skel.h" void test_linked_funcs(void) { int err; struct linked_funcs *skel; skel = linked_funcs__open(); if (!ASSERT_OK_PTR(skel, "skel_open")) return; /* handler1...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/prog_tests/socket_helpers' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ #ifndef __SOCKET_HELPERS__ #define __SOCKET_HELPERS__ #include <sys/un.h> #include <linux/vm_sockets.h> /* include/linux/net.h */ #define SOCK_TYPE_MASK 0xf #define IO_TIMEOUT_SEC 30 #define MAX_STRERR_LEN 256 /* workaround for older vm_sockets.h */ #ifndef VMADDR_CID_LO...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/read_vsyscall' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2024. Huawei Technologies Co., Ltd */ #include "test_progs.h" #include "read_vsyscall.skel.h" #if defined(__x86_64__) /* For VSYSCALL_ADDR */ #include <asm/vsyscall.h> #else /* To prevent build failure on non-x86 arch */ #define VSYSCALL_ADDR 0UL #endif struct...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/kptr_xchg_inline' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2023. Huawei Technologies Co., Ltd */ #include <test_progs.h> #include "linux/filter.h" #include "kptr_xchg_inline.skel.h" void test_kptr_xchg_inline(void) { struct kptr_xchg_inline *skel; struct bpf_insn *insn = NULL; struct bpf_insn exp; unsigned int cnt...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <uapi/linux/bpf.h> #include <linux/if_link.h> #include <test_progs.h> #include <network_helpers.h> #include "test_xdp_with_cpumap_frags_helpers.skel.h" #include "test_xdp_with_cpumap_helpers.skel.h" #define IFINDEX_LO 1 #define TEST_NS "cpu_attach_ns" static void tes...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_struct_ops_no_cfi' 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 <testing_helpers.h> static void load_bpf_test_no_cfi(void) { int fd; int err; fd = open("bpf_test_no_cfi.ko", O_RDONLY); if (!ASSERT_GE(fd, 0, "open")) return; /* The module ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/btf_split' 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 <bpf/btf.h> static char *dump_buf; static size_t dump_buf_sz; static FILE *dump_buf_file; static void btf_dump_printf(void *ctx, const char *fmt, va_list args) { vfprintf(ctx, fmt, args); } /* Write raw BTF t...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/btf_skc_cls_ingress' 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 <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <sched.h> #include <net/if.h> #include <linux/compiler.h> #include <bpf/libbpf.h> #inclu...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/sock_ops_get_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 "network_helpers.h" #include "sock_ops_get_sk.skel.h" /* See progs/sock_ops_get_sk.c for the bug description. */ static void run_sock_ops_test(int cgroup_fd, int prog_fd) { int server_fd, client_fd, err; err = bpf...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/lwt_reroute' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* * Test suite of lwt BPF programs that reroutes packets * The file tests focus not only if these programs work as expected normally, * but also if they can handle abnormal situations gracefully. This test * suite currently only covers lwt_xmit hook. ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/task_pt_regs' 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 "test_task_pt_regs.skel.h" /* uprobe attach point */ static noinline void trigger_func(void) { asm volatile (""); } void test_task_pt_regs(void) { struct test_task_pt_regs *skel; struct bpf_link *uprobe_link; ssize_t upr...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/tailcalls' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <unistd.h> #include <test_progs.h> #include <network_helpers.h> #include "tailcall_poke.skel.h" #include "tailcall_bpf2bpf_hierarchy2.skel.h" #include "tailcall_bpf2bpf_hierarchy3.skel.h" #include "tailcall_freplace.skel.h" #include "tc_bpf2bpf.skel.h" #include "tailcal...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/cgroup_tcp_skb' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Facebook */ #include <test_progs.h> #include <linux/in6.h> #include <sys/socket.h> #include <sched.h> #include <unistd.h> #include "cgroup_helpers.h" #include "testing_helpers.h" #include "cgroup_tcp_skb.skel.h" #include "cgroup_tcp_skb.h" #include "network...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/map_kptr' 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 "map_kptr.skel.h" #include "map_kptr_fail.skel.h" #include "rcu_tasks_trace_gp.skel.h" static void test_map_kptr_success(bool test_run) { LIBBPF_OPTS(bpf_test_run_opts, lopts); LIBBPF_OPTS(bpf_test_run_opts, opts,...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/btf_dedup_split' 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 <bpf/btf.h> #include "btf_helpers.h" static void test_split_simple() { const struct btf_type *t; struct btf *btf1, *btf2; int str_off, err; btf1 = btf__new_empty(); if (!ASSERT_OK_PTR(btf1, "empty_main_btf...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/enable_stats' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include "test_enable_stats.skel.h" void test_enable_stats(void) { struct test_enable_stats *skel; int stats_fd, err, prog_fd; struct bpf_prog_info info; __u32 info_len = sizeof(info); int duration = 0; skel = test_enable_stats__open_and_load(); ...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/prog_run_opts' 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_pkt_access.skel.h" static const __u32 duration; static void check_run_cnt(int prog_fd, __u64 run_cnt) { struct bpf_prog_info info = {}; __u32 info_len = sizeof(info); int err; err = bpf_prog_get_info_by_...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/legacy_printk' 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 "test_legacy_printk.skel.h" static int execute_one_variant(bool legacy) { struct test_legacy_printk *skel; int err, zero = 0, my_pid = getpid(), res, map_fd; skel = test_legacy_printk__open(); if (!ASSERT_O...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/btf_write' 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 <bpf/btf.h> #include "btf_helpers.h" static void gen_btf(struct btf *btf) { const struct btf_var_secinfo *vi; const struct btf_type *t; const struct btf_member *m; const struct btf_enum64 *v64; const struct...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/ctx_rewrite' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <limits.h> #include <stdio.h> #include <string.h> #include <ctype.h> #include <regex.h> #include <test_progs.h> #include "bpf/btf.h" #include "bpf_util.h" #include "linux/filter.h" #include "linux/kernel.h" #include "disasm_helpers.h" #define MAX_PROG_TEXT_SZ (32 * 1...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_struct_ops_module' 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 <time.h> #include <sys/epoll.h> #include "struct_ops_module.skel.h" #include "struct_ops_nulled_out_cb.skel.h" #include "struct_ops_forgotten_cb.skel.h" #include "struct_ops_detach.s...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_veristat' 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 <string.h> #include <stdio.h> #define __CHECK_STR(str, name) \ do { \ if (!ASSERT_HAS_SUBSTR(fix->output, (str), (name))) \ goto out; \ } while (0) st...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/queue_stack_map' 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> enum { QUEUE, STACK, }; static void test_queue_stack_map_by_type(int type) { const int MAP_SIZE = 32; __u32 vals[MAP_SIZE], val; int i, err, prog_fd, map_in_fd, map_out_fd; char file[32], buf[128]; struct bpf_object *...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/cgroup_attach_override' 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 FOO "/foo" #define BAR "/foo/bar/" #define PING_CMD "ping -q -c1 -w1 127.0.0.1 > /dev/null" static char bpf_log_buf[BPF_LOG_BUF_SIZE]; static int prog_load(int verdict) { struct bpf_insn prog[] = { BPF_MOV64_I...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/tp_attach_query' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> void serial_test_tp_attach_query(void) { const int num_progs = 3; int i, j, bytes, efd, err, prog_fd[num_progs], pmu_fd[num_progs]; __u32 duration = 0, info_len, saved_prog_ids[num_progs]; const char *file = "./test_tracepoint.bpf.o"; struct perf_ev...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/cb_refs' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "bpf/libbpf.h" #include <test_progs.h> #include <network_helpers.h> #include "cb_refs.skel.h" static char log_buf[1024 * 1024]; struct { const char *prog_name; const char *err_msg; } cb_refs_tests[] = { { "underflow_prog", "must point to scalar, or struct with sca...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/tc_links' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Isovalent */ #include <uapi/linux/if_link.h> #include <uapi/linux/pkt_sched.h> #include <net/if.h> #include <test_progs.h> #define loopback 1 #define ping_cmd "ping -q -c1 -w1 127.0.0.1 > /dev/null" #include "test_tc_link.skel.h" #include "netlink_helper...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/prog_tests/task_local_data' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */ #ifndef __TASK_LOCAL_DATA_H #define __TASK_LOCAL_DATA_H #include <errno.h> #include <fcntl.h> #include <sched.h> #include <stdatomic.h> #include <stddef.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/syscall.h> #include <sys/t...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/subprogs_extable' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include "test_subprogs_extable.skel.h" void test_subprogs_extable(void) { const int read_sz = 456; struct test_subprogs_extable *skel; int err; skel = test_subprogs_extable__open_and_load(); if (!ASSERT_OK_PTR(skel, "skel_open_and_load")) retur...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/pinning_devmap_reuse' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <test_progs.h> #include "test_pinning_devmap.skel.h" void test_pinning_devmap_reuse(void) { const char *pinpath1 = "/sys/fs/bpf/pinmap1"; const char *pinpath2 = "/sys/fs/bpf/pinmap2"; struct test_pi...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/kfunc_dynptr_param' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2022 Facebook * Copyright (C) 2022 Huawei Technologies Duesseldorf GmbH * * Author: Roberto Sassu <roberto.sassu@huawei.com> */ #include <test_progs.h> #include "test_kfunc_dynptr_param.skel.h" static struct { const char *prog_name; int expected_runt...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/dummy_st_ops' 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 "dummy_st_ops_success.skel.h" #include "dummy_st_ops_fail.skel.h" #include "trace_dummy_st_ops.skel.h" /* Need to keep consistent with definition in include/linux/bpf.h */ struct bpf_dummy_o...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/bpf_iter' 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 <unistd.h> #include <sys/syscall.h> #include <task_local_storage_helpers.h> #include "bpf_iter_ipv6_route.skel.h" #include "bpf_iter_netlink.skel.h" #include "bpf_iter_bpf_map.skel.h" #include "bpf_iter_tasks.ske...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/fentry_test' 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 "fentry_many_args.skel.h" static int fentry_test_common(struct fentry_test_lskel *fentry_skel) { int err, prog_fd, i; int link_fd; __u64 *result; LIBBPF_OPTS(bpf_test_run_opts,...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/sockmap_redir' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Test for sockmap/sockhash redirection. * * BPF_MAP_TYPE_SOCKMAP * BPF_MAP_TYPE_SOCKHASH * x * sk_msg-to-egress * sk_msg-to-ingress * sk_skb-to-egress * sk_skb-to-ingress * x * AF_INET, SOCK_STREAM * AF_INET6, SOCK_STREAM * AF_INET, SOCK_DGRAM * AF_INET6, SOCK_...
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/stacktrace_build_id_nmi' 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_nmi(void) { int control_map_fd, stackid_hmap_fd, stackmap_fd; struct test_stacktrace_build_id *skel; int err, pmu_fd; struct perf_event_attr attr = { .freq = 1, .type = PERF...