instruction
stringlengths
82
202
input
stringclasses
1 value
output
stringlengths
73
23.9M
Linux kernel'inin 'tools/testing/selftests/bpf/progs/btf_type_tag_percpu' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022 Google */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> struct bpf_testmod_btf_type_tag_1 { int a; }; struct bpf_testmod_btf_type_tag_2 { struct bpf_testmod_btf_type_tag_1 *p; }; __u64 g; SEC("fentry/bpf_testmod_test_b...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/stream_fail' 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 <vmlinux.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> #include "bpf_misc.h" SEC("syscall") __failure __msg("Possibly NULL pointer passed") int stream_vprintk_nu...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cgroup_hierarchical_stats' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * Copyright 2022 Google LLC. */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_core_read.h> char _license[] SEC("license") = "GPL"; struct percpu_attach_counter { /* Previous percpu state, to figure out if we have ne...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/arena_htab_asm' 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. */ #define BPF_ARENA_FORCE_ASM #define arena_htab_llvm arena_htab_asm #include "arena_htab.c" ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/preempt_lock' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "bpf_experimental.h" extern int bpf_copy_from_user_str(void *dst, u32 dst__sz, const void *unsafe_ptr__ign, u64 flags) __weak __ksym; SEC("?tc") __failure __msg("BPF_E...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cgroup_ancestor' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2018 Facebook #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> #include "bpf_tracing_net.h" #define NUM_CGROUP_LEVELS 4 __u64 cgroup_ids[NUM_CGROUP_LEVELS]; __u16 dport; static __always_inline void log_nth_level(struct __sk_buf...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/epilogue_exit' 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 <vmlinux.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "../test_kmods/bpf_testmod.h" #include "../test_kmods/bpf_testmod_kfunc.h" char _license[] SEC("license") = "GPL"; __success /* save ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_global_func3' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2020 Facebook */ #include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" static __attribute__ ((noinline)) int f1(struct __sk_buff *skb) { return skb->len; } static __attribute__ ((noinline)) int f2(int val, struct _...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/uprobe_syscall' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <string.h> struct pt_regs regs; char _license[] SEC("license") = "GPL"; SEC("uprobe") int probe(struct pt_regs *ctx) { __builtin_memcpy(&regs, ctx, sizeof(regs)); return 0; } ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_id_ops_mapping2' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "../test_kmods/bpf_testmod.h" #include "../test_kmods/bpf_testmod_kfunc.h" char _license[] SEC("license") = "GPL"; #define bpf_kfunc_multi_st_ops_test_1(args) bpf_kfunc_multi_st_ops_test_1(args, ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_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. If reuse_md->migrating_sk is NULL (SYN packet), * return SK_PASS without selecting a listener. * 2. If reuse_md->migrating_sk is not NULL (socket migration), * select a listener (reuseport_map[migrate_map...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_log_fixup' 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 <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> struct task_struct___bad { int pid; int fake_field; void *fake_field_subprog; } __attribute__((preserve_access_index)); SEC("?ra...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_or_jmp32_k' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" SEC("socket") __description("or_jmp32_k: bit ops + branch on unknown value") __failure __msg("R0 invalid mem access 'scalar'") __naked void or_jmp32_k(void) { asm volatile (" \ r0 = 0xffffffff; ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_xdp_direct_packet_access' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/xdp_direct_packet_access.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" SEC("xdp") __description("XDP pkt read, pkt_end mangling, bad access 1") __failure __msg("R3 pointer arithmetic on pkt...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/uprobe_multi_usdt' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/usdt.bpf.h> char _license[] SEC("license") = "GPL"; int count; SEC("usdt") int usdt0(struct pt_regs *ctx) { count++; return 0; } ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_global_func6' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2020 Facebook */ #include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" __attribute__ ((noinline)) int f1(struct __sk_buff *skb) { return skb->len; } int f3(int, struct __sk_buff *skb); __attribute__ ((noinline)) i...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_reg_equal' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" SEC("socket") __description("check w reg equal if r reg upper32 bits 0") __success __naked void subreg_equality_1(void) { asm volatile (" \ call %[bpf_ktime_get_ns]; \ *(u64 *)(r10 - 8) = r0; ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/fexit_bpf2bpf_simple' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2019 Facebook */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> struct sk_buff { unsigned int len; }; __u64 test_result = 0; SEC("fexit/test_pkt_md_access") int BPF_PROG(test_main2, struct sk_buff *skb, int ret) { int len; ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_btf_decl_tag' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #if __has_attribute(btf_decl_tag) #define __tag1 __attribute__((btf_decl_tag("tag1"))) #define __tag2 __attribute__((btf_decl_tag("tag2"))) volatile const bool skip_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/perf_event_stackmap' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2020 Facebook #include "vmlinux.h" #include <bpf/bpf_helpers.h> #ifndef PERF_MAX_STACK_DEPTH #define PERF_MAX_STACK_DEPTH 127 #endif typedef __u64 stack_trace_t[PERF_MAX_STACK_DEPTH]; struct { __uint(type, BPF_MAP_TYPE_STACK_TRACE); __uint(max_entrie...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cgroup_getset_retval_setsockopt' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * Copyright 2021 Google LLC. */ #include <errno.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> __u32 invocations = 0; __u32 assertion_error = 0; __u32 retval_value = 0; __s32 page_size = 0; SEC("cgroup/setsockopt") int get_retval(struct bpf_sockopt *ctx) { ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_autoload' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_core_read.h> bool prog1_called = false; bool prog2_called = false; bool prog3_called = false; SEC("raw_tp/sys_enter") int prog1(const void *ctx) ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_perf_buffer' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Facebook #include <linux/ptrace.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> struct { __uint(type, BPF_MAP_TYPE_ARRAY); __type(key, int); __type(value, int); __uint(max_entries, 1); } my_pid_map SEC(".maps"); st...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_xdp_devmap_tailcall' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> SEC("xdp") int xdp_devmap(struct xdp_md *ctx) { return ctx->egress_ifindex; } struct { __uint(type, BPF_MAP_TYPE_PROG_ARRAY); __uint(max_entries, 1); __uint(key_size, sizeof(__u32)); __array(v...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/linked_maps2' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> /* modifiers and typedefs are ignored when comparing key/value types */ typedef struct my_key { long x; } key_type; typedef struct my_value { long x; } value_type; ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/uprobe_multi_session_single' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <stdbool.h> #include "bpf_kfuncs.h" #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; __u64 uprobe_session_result[3] = {}; int pid = 0; static int uprobe_multi_check(void *ct...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/kprobe_write_ctx' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; #if defined(__TARGET_ARCH_x86) SEC("kprobe") int kprobe_write_ctx(struct pt_regs *ctx) { ctx->ax = 0; return 0; } SEC("kprobe.multi") int kprobe_multi_writ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_fill_link_info' 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 "vmlinux.h" #include <bpf/bpf_tracing.h> #include <stdbool.h> extern bool CONFIG_X86_KERNEL_IBT __kconfig __weak; extern bool CONFIG_PPC_FTRACE_OUT_OF_LINE __kconfig __weak; extern bool CONFIG_KPROBES_ON_FTRA...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_cubic' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* WARNING: This implementation is not necessarily the same * as the tcp_cubic.c. The purpose is mainly for testing * the kernel BPF logic. * * Highlights: * 1. CONFIG_HZ .kconfig map is used. * 2. In bictcp_update(), calculation is changed to use usec * resolut...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/recursion' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_HASH); __uint(max_entries, 1); __type(key, int); __type(value, long); } hash1 SEC("....
Linux kernel'inin 'tools/testing/selftests/bpf/progs/percpu_alloc_fail' alt sistemi için gerekli C kaynak kodunu implemente et.
```c #include "bpf_experimental.h" #include "bpf_misc.h" struct val_t { long b, c, d; }; struct val2_t { long b; }; struct val_with_ptr_t { char *p; }; struct val_with_rb_root_t { struct bpf_spin_lock lock; }; struct val_600b_t { char b[600]; }; struct elem { long sum; struct val_t __percpu_kptr *pc; }; s...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/lsm' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Copyright 2020 Google LLC. */ #include "vmlinux.h" #include <errno.h> #include <bpf/bpf_core_read.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 1); __type(key, __u32)...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_core_reloc_module' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; struct bpf_testmod_test_read_ctx { /* field order is mixed up */ size_t len; char *buf; ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/linked_vars1' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> extern int LINUX_KERNEL_VERSION __kconfig; /* this weak extern will be strict due to the other file's strong extern */ extern bool CONFIG_BPF_SYSCALL __kconfig __we...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/bpf_arena_spin_lock' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2025 Meta Platforms, Inc. and affiliates. */ #ifndef BPF_ARENA_SPIN_LOCK_H #define BPF_ARENA_SPIN_LOCK_H #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include "bpf_atomic.h" #define arch_mcs_spin_lock_contended_label(l, label) smp_cond_load_acquire_label(...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_sock' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/sock.c */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include "bpf_misc.h" struct { __uint(type, BPF_MAP_TYPE_REUSEPORT_SOCKARRAY); __uint(max_entries, 1); __type(key, __u32); __type(value, __u64); } map_reusepo...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/res_spin_lock_fail' 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 <vmlinux.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> #include "bpf_misc.h" #include "bpf_experimental.h" struct arr_elem { struct bpf_res_spin_lock lock;...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/local_storage_bench' 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 "vmlinux.h" #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #define HASHMAP_SZ 4194304 struct { __uint(type, BPF_MAP_TYPE_ARRAY_OF_MAPS); __uint(max_entries, 1000); __type(key, int); __type(value, i...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/uprobe_multi_session_recursive' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <stdbool.h> #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; int pid = 0; int idx_entry = 0; int idx_return = 0; __u64 test_uprobe_cookie_entry[6]; __u64 test_uprobe_cookie_r...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/exceptions_fail' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> #include "bpf_misc.h" #include "bpf_experimental.h" extern void bpf_rcu_read_lock(void) __ksym; extern void bpf_rcu_read_unlock(void) __ksym; extern void bpf_preempt_d...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_lwt_redirect' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_endian.h> #include <bpf/bpf_helpers.h> #include <linux/ip.h> #include <linux/if_ether.h> /* We don't care about whether the packet can be received by network stack. * Just care if the packet is sent to the correct device at correct dire...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_unpriv_perf' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/unpriv.c */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include "bpf_misc.h" SEC("perf_event") __description("unpriv: spill/fill of different pointers ldx") __failure __msg("same insn cannot be used with different p...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/xfrm_info' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #define BPF_NO_KFUNC_PROTOTYPES #include "vmlinux.h" #include "bpf_tracing_net.h" #include <bpf/bpf_helpers.h> struct bpf_xfrm_info___local { u32 if_id; int link; } __attribute__((preserve_access_index)); __u32 req_if_id; __u32 resp_if_id; int bpf_skb_set_xfrm_info(struct _...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_btf_ctx_access' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/btf_ctx_access.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" SEC("fentry/bpf_modify_return_test") __description("btf_ctx_access accept") __success __retval(0) __naked void btf_ctx_access_ac...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cgrp_ls_negative' 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 "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_CGRP_STORAGE); __uint(map_flags, BPF_F_NO_PREALLOC); __ty...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/rcu_tasks_trace_gp' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include "../test_kmods/bpf_testmod_kfunc.h" int done; SEC("syscall") int call_rcu_tasks_trace(void *ctx) { return bpf_kfunc_call_test_call_rcu_tasks_trace(&done); } char _license[] SEC("license") = "GPL"; ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_core_reloc_ptr_as_arr' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Facebook #include <linux/bpf.h> #include <stdint.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> char _license[] SEC("license") = "GPL"; struct { char in[256]; char out[256]; } data = {}; struct core_reloc_ptr_as_arr { int a; }; #defi...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/connect4_dropper' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <string.h> #include <linux/stddef.h> #include <linux/bpf.h> #include <sys/socket.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #define VERDICT_REJECT 0 #define VERDICT_PROCEED 1 int port; SEC("cgroup/connect4") int connect_v4_dropper(struct bpf_sock...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_masking' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/masking.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" SEC("socket") __description("masking, test out of bounds 1") __success __success_unpriv __retval(0) __naked void test_out_of_bounds_1(v...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_sockmap_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2018 Covalent IO, Inc. http://covalent.io #define SOCKMAP #define TEST_MAP_TYPE BPF_MAP_TYPE_SOCKMAP #include "./test_sockmap_kern.h" ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/find_vma_fail1' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #define vm_flags vm_start char _license[] SEC("license") = "GPL"; struct callback_ctx { int dummy; }; static long write_vma(struct task_struct *task, struct vm_area_struct *vma, struc...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/btf_type_tag_user' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022 Facebook */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> struct bpf_testmod_btf_type_tag_1 { int a; }; struct bpf_testmod_btf_type_tag_2 { struct bpf_testmod_btf_type_tag_1 *p; }; int g; SEC("fentry/bpf_testmod_test_b...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_verif_scale3' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Facebook #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #define ATTR __attribute__((noinline)) #include "test_jhash.h" SEC("tc") int balancer_ingress(struct __sk_buff *ctx) { void *data_end = (void *)(long)ctx->data_end; void *data = (void *)(long)c...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/timer_lockup' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <time.h> #include <errno.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; struct elem { struct bpf_timer t; }; struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_e...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/find_vma' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; struct callback_ctx { int dummy; }; #define VM_EXEC 0x00000004 #define DNAME_INLINE_LEN 32 pid_t target_pid = 0; char d_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_ringbuf' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/ringbuf.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" struct { __uint(type, BPF_MAP_TYPE_RINGBUF); __uint(max_entries, 4096); } map_ringbuf SEC(".maps"); SEC("socket") __description("rin...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_subprog_topo' 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 <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" /* linear chain main -> A -> B */ __naked __noinline __used static unsigned long linear_b(void) { asm volatile ( "r0 = 42;" "exit;" ); ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_bpf_nf_fail' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #define BPF_NO_KFUNC_PROTOTYPES #include <vmlinux.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> #include "bpf_misc.h" struct nf_conn; struct bpf_ct_opts___local { s32 netns_id; s32 error; u8 l4proto; u8 reserved[3]; } __attribu...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_var_off' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/var_off.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" struct { __uint(type, BPF_MAP_TYPE_HASH); __uint(max_entries, 1); __type(key, long long); __type(value, long long); } map_hash_8b S...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_value_ptr_arith' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/value_ptr_arith.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <errno.h> #include "bpf_misc.h" #define MAX_ENTRIES 11 struct test_val { unsigned int index; int foo[MAX_ENTRIES]; }; struct { __uint(t...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/loop4' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Facebook #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_compiler.h" char _license[] SEC("license") = "GPL"; SEC("socket") int combinations(volatile struct __sk_buff* skb) { int ret = 0, i; __pragma_loop_no_unroll for (i = 0; i < 20...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/strobemeta_bpf_loop' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) /* Copyright (c) 2021 Facebook */ #define STROBE_MAX_INTS 2 #define STROBE_MAX_STRS 25 #define STROBE_MAX_MAPS 100 #define STROBE_MAX_MAP_ENTRIES 20 #define USE_BPF_LOOP #include "strobemeta.h" ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/sock_destroy_prog_fail' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "vmlinux.h" #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; int bpf_sock_destroy(struct sock_common *sk) __ksym; SEC("tp_btf/tcp_destroy_sock") __failure __msg("calling kernel function bpf_sock...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_hashmap_lookup' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Isovalent */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_HASH); } hash_map_bench SEC(".maps"); /* The number of slots to store times */ #define NR_S...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/string_kfuncs_failure2' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2025 Red Hat, Inc.*/ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <linux/limits.h> char long_str[XATTR_SIZE_MAX + 1]; SEC("syscall") int test_strcmp_too_long(void *ctx) { return bpf_strcmp(long_str, long_str); } SEC("syscall") int test_strcasecmp...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/rbtree_btf_fail__wrong_node_type' 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 <vmlinux.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> #include "bpf_experimental.h" /* BTF load should fail as bpf_rb_root __contains this type and points to ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_l4lb' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Copyright (c) 2017 Facebook * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. */ #include <stddef.h> #include <stdbool.h> #include <string.h> #include <linux/pkt_cls.h>...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_spill_fill' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/spill_fill.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #include <../../../tools/include/linux/filter.h> struct { __uint(type, BPF_MAP_TYPE_RINGBUF); __uint(max_entries, 4096); } map_rin...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/connect_unix_prog' 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 "vmlinux.h" #include <string.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> #include "bpf_kfuncs.h" __u8 SERVUN_REWRITE_ADDRESS[] = "\0bpf_cgroup_unix_test_rewrite"; SEC("cgroup/connect_un...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tcp_ca_kfunc' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 Facebook */ #include "vmlinux.h" #include <bpf/bpf_tracing.h> extern void bbr_init(struct sock *sk) __ksym; extern void bbr_main(struct sock *sk, u32 ack, int flag, const struct rate_sample *rs) __ksym; extern u32 bbr_sndbuf_expand(struct sock *sk) __ksym...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/freplace_progmap' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_helpers.h> struct { __uint(type, BPF_MAP_TYPE_CPUMAP); __type(key, __u32); __type(value, struct bpf_cpumap_val); __uint(max_entries, 1); } cpu_map SEC(".maps"); SEC("xdp/cpumap") int xdp_drop_prog(struct xdp_md *ctx) { return XDP_D...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tailcall_bpf2bpf3' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_legacy.h" #include "bpf_misc.h" struct { __uint(type, BPF_MAP_TYPE_PROG_ARRAY); __uint(max_entries, 2); __uint(key_size, sizeof(__u32)); __uint(value_size, sizeof(__u32)); } jmp_table SEC(".maps"); __noinlin...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tailcall_bpf2bpf_hierarchy_fentry' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright Leon Hwang */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_test_utils.h" struct { __uint(type, BPF_MAP_TYPE_PROG_ARRAY); __uint(max_entries, 1); __uint(key_size, sizeof(__u32)); __uint(value_size, sizeof(__u32));...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_sock_addr' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 Google LLC */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf_sockopt_helpers.h> #include "bpf_misc.h" SEC("cgroup/recvmsg4") __success int recvmsg4_good_return_code(struct bpf_sock_addr *ctx) { return 1; } SEC("cgroup/recvmsg4") __fai...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_ctx' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2026 Valve Corporation. * Author: Changwoo Min <changwoo@igalia.com> */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_experimental.h" char _license[] SEC("license") = "GPL"; extern void bpf_kfunc_trigger_ctx...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_kptr_return' alt sistemi için gerekli C kaynak kodunu implemente et.
```c #include <vmlinux.h> #include <bpf/bpf_tracing.h> #include "../test_kmods/bpf_testmod.h" #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; void bpf_task_release(struct task_struct *p) __ksym; /* This test struct_ops BPF programs returning referenced kptr. The verifier should * allow a referenced kp...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_bpf_sk_storage_map' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include <vmlinux.h> #include "bpf_tracing_net.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_SK_STORAGE); __uint(map_flags, BPF_F_NO_PREALLOC); __type...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/priv_freplace_prog' 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 "vmlinux.h" #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; SEC("freplace/xdp_prog1") int new_xdp_prog2(struct xdp_md *xd) { return XDP_DROP; } ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_bswap' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ defined(__...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_lwt_seg6local' alt sistemi için gerekli C kaynak kodunu implemente et.
```c #include <stddef.h> #include <inttypes.h> #include <errno.h> #include <linux/seg6_local.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #include "bpf_compiler.h" /* Packet parsing state machine helpers. */ #define cursor_advance(_cursor, _len) \ ({ void *_tmp = _cursor; _curso...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/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 "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; SEC("?fentry/bpf_spin_lock") int BPF_PROG(test_spin_lock, struct bpf_spin_lock *lock) { return...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/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. */ #define BPF_NO_KFUNC_PROTOTYPES #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_core_read.h> #include "bpf_experimental.h" struct { __uint(type, BPF_MAP_TYPE_ARENA); ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bench_sockmap_prog' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> long process_byte = 0; int verdict_dir = 0; int dropped = 0; int pkt_size = 0; struct { __uint(type, BPF_MAP_TYPE_SOCKMAP); __uint(max_entries, 20); __type(key, int); __type(value, int); } so...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/iters_state_safety' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022 Facebook */ #include <errno.h> #include <string.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; #define ITER_HELPERS \ __imm(bpf_iter_num_new), \ __imm(bpf_iter_num_next),...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_load_acquire' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2025 Google LLC. */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "../../../include/linux/filter.h" #include "bpf_misc.h" #ifdef CAN_USE_LOAD_ACQ_STORE_REL SEC("socket") __description("load-acquire, 8-bit") __success __success_unpriv __retval(0...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/sock_destroy_prog' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #include "bpf_tracing_net.h" __be16 serv_port = 0; int bpf_sock_destroy(struct sock_common *sk) __ksym; struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 1); __type(key, __u32); _...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_pkt_access' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2017 Facebook */ #include <stddef.h> #include <string.h> #include <linux/bpf.h> #include <linux/if_ether.h> #include <linux/if_packet.h> #include <linux/ip.h> #include <linux/ipv6.h> #include <linux/in.h> #include <linux/tcp.h> #include <linux/pkt_cls.h> #...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_btf_map_in_map' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* SPDX-License-Identifier: GPL-2.0 */ /* Copyright (c) 2020 Facebook */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> struct inner_map { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 1); __type(key, int); __type(value, int); } inner_map1 SEC(".maps"), inner_map2 SEC(".maps"); struct inner_ma...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/map_ptr_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2020 Facebook #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #define LOOP_BOUND 0xf #define MAX_ENTRIES 8 #define HALF_ENTRIES (MAX_ENTRIES >> 1) _Static_assert(MAX_ENTRIES < LOOP_BOUND, "MAX_ENTRIES must be < LOOP_BOUND"); enum bpf_map_type g_map_type ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_test_kern6' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; __u32 value_sum = 0; SEC("iter/bpf_map_elem") int dump_bpf_hash_map(struct bpf_iter__bpf_map_elem *ctx) { void *value = ctx->value; if (value == (voi...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cgrp_ls_tp_btf' 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 "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_CGRP_STORAGE); __uint(map_flags, BPF_F_NO_PREALLOC); __ty...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_core_reloc_enum64val' 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 <linux/bpf.h> #include <stdint.h> #include <stdbool.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> char _license[] SEC("license") = "GPL"; struct { char in[256]; char out[256]; bool skip...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_tc_change_tail' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "vmlinux.h" #include <bpf/bpf_helpers.h> #ifndef PAGE_SIZE #define PAGE_SIZE __PAGE_SIZE #endif #define BPF_SKB_MAX_LEN (PAGE_SIZE << 2) long change_tail_ret = 1; static __always_inline struct iphdr *parse_ip_header(struct __sk_buff *skb, int *ip_proto) { void *data...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/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 */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; struct inner_map_type { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(key_size, 4); __uint(value_size, 4); __uint(max_entries, 1); ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_hash_large_key' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_HASH); __uint(max_entries, 2); __type(key, struct bigelement); __type(value, __u32); } hash_map SEC(".maps"); struct { __uint(type, BPF_MAP_TYP...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/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 <vmlinux.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> #include "bpf_misc.h" #include "bpf_experimental.h" extern void bpf_rcu_read_lock(void) __ksym; extern vo...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tailcall_bpf2bpf_fexit' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright Leon Hwang */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> int count = 0; SEC("fexit/subprog_tail") int BPF_PROG(fexit, struct sk_buff *skb) { count++; return 0; } char _license[] SEC("license") = "GPL"; ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/kfunc_call_test' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #include "../test_kmods/bpf_testmod_kfunc.h" SEC("tc") int kfunc_call_test5(struct __sk_buff *skb) { struct bpf_sock *sk = skb->sk; int ret; u32 val32; u16 val16; u8 v...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_btf_nokv' 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 <bpf/bpf_helpers.h> struct ipv_counts { unsigned int v4; unsigned int v6; }; struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(key_size, sizeof(int)); __uint(value_size, sizeof(struct ipv_counts)); __ui...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/test_user_ringbuf' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ /* Copyright (c) 2022 Meta Platforms, Inc. and affiliates. */ #ifndef _TEST_USER_RINGBUF_H #define _TEST_USER_RINGBUF_H #define TEST_OP_64 4 #define TEST_OP_32 2 enum test_msg_op { TEST_MSG_OP_INC64, TEST_MSG_OP_INC32, TEST_MSG_OP_MUL64, TEST_MSG_OP_MUL32, // Must co...