instruction
stringlengths
82
202
input
stringclasses
1 value
output
stringlengths
73
23.9M
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_check_mtu' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Jesper Dangaard Brouer */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <linux/if_ether.h> #include <stddef.h> #include <stdint.h> #include <errno.h> char _license[] SEC("license") = "GPL"; /* Userspace will update with MTU it can see on ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/btf_dump_test_case_packing' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) /* * BTF-to-C dumper tests for struct packing determination. * * Copyright (c) 2019 Facebook */ /* ----- START-EXPECTED-OUTPUT ----- */ struct packed_trailing_space { int a; short b; } __attribute__((packed)); struct non_packed_trailing_space { int a;...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/bpf_tracing_net' 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 __BPF_TRACING_NET_H__ #define __BPF_TRACING_NET_H__ #include <vmlinux.h> #include <bpf/bpf_core_read.h> #define AF_INET 2 #define AF_INET6 10 #define SOL_SOCKET 1 #define SO_REUSEADDR 2 #define SO_SNDBUF 7 #define SO_RCVBUF 8 #define SO_KE...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/lsm_cgroup' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "vmlinux.h" #include "bpf_tracing_net.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; extern bool CONFIG_SECURITY_SELINUX __kconfig __weak; extern bool CONFIG_SECURITY_SMACK __kconfig __weak; extern bool CONFIG_SEC...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/uptr_update_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 "uptr_test_common.h" struct { __uint(type, BPF_MAP_TYPE_TASK_STORAGE); __uint(map_flags, BPF_F_NO_PREALLOC); __type(key, int); __type(value, struct valu...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_xdp_do_redirect' 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> #define ETH_ALEN 6 #define HDR_SZ (sizeof(struct ethhdr) + sizeof(struct ipv6hdr) + sizeof(struct udphdr)) /** * enum frame_mark - magics to distinguish page/packet paths * @MARK_XMIT: page was recycled due to the frame being...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_task_pt_regs' 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> #define PT_REGS_SIZE sizeof(struct pt_regs) /* * The kernel struct pt_regs isn't exported in its entirety to userspace. * Pass it as an array to task_pt_regs.c */ char current_regs[PT_REGS_SIZE]...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_xdp_loop' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 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/udp.h> #include <linux/tcp.h> #include <linu...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/skb_pkt_end' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #ifndef BPF_NO_PRESERVE_ACCESS_INDEX #define BPF_NO_PRESERVE_ACCESS_INDEX #endif #include <vmlinux.h> #include <bpf/bpf_core_read.h> #include <bpf/bpf_helpers.h> #define INLINE __always_inline #define skb_shorter(skb, len) ((void *)(long)(skb)->data + (len) > (void *)(long)skb...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_flow' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <limits.h> #include <stddef.h> #include <stdbool.h> #include <string.h> #include <linux/pkt_cls.h> #include <linux/bpf.h> #include <linux/in.h> #include <linux/if_ether.h> #include <linux/icmp.h> #include <linux/ip.h> #include <linux/ipv6.h> #include <linux/tcp.h> #incl...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/timer_crash' 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> struct map_elem { struct bpf_timer timer; struct bpf_spin_lock lock; }; struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 1); __type(key, int); __type(value, struct map_elem); } ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_gotox' 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/bpf_core_read.h> #include "bpf_misc.h" __u64 in_user; __u64 ret_user; int pid; /* * Skip all the tests if compiler doesn't support indirect jumps. * * If tests are skipped, then a...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/for_each_map_elem_write_key' 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> struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 1); __type(key, __u32); __type(value, __u64); } array_map SEC(".maps"); static __u64 check_array_elem(struct bpf_map *map, __u32 *key, __u64 *val, void *data...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_map_elem' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #include "vmlinux.h" #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; __u32 value_sum = 0; SEC("iter/bpf_map_elem") int dump_bpf_map_values(struct bpf_iter__bpf_map_elem *ctx) { __u32 value = 0; if (ctx->value == (void...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/xdp_dummy' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #define KBUILD_MODNAME "xdp_dummy" #include <linux/bpf.h> #include <bpf/bpf_helpers.h> SEC("xdp") int xdp_dummy_prog(struct xdp_md *ctx) { return XDP_PASS; } char _license[] SEC("license") = "GPL"; ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_core_reloc_type_based' 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 <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; } data = {}; struct a_struct...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_core_read_macros' 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> char _license[] SEC("license") = "GPL"; /* shuffled layout for relocatable (CO-RE) reads */ struct callback_head___shuffled { void (*func)(struct callback_head___s...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/iters_looping' 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 <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), \ ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/freplace_dead_global_func' 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> SEC("freplace") int freplace_prog(void) { return 0; } char _license[] SEC("license") = "GPL"; ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/uptr_map_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 "uptr_test_common.h" struct { __uint(type, BPF_MAP_TYPE_TASK_STORAGE); __uint(map_flags, BPF_F_NO_PREALLOC); __type(key, int); __type(value, struct larg...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_task_vmas' 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"; /* Copied from mm.h */ #define VM_READ 0x00000001 #define VM_WRITE 0x00000002 #define VM_EXEC 0x00000004 #define VM_MAYSHARE 0x00000080 /* Copied from...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/kfunc_call_test_subprog' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include "../test_kmods/bpf_testmod_kfunc.h" extern const int bpf_prog_active __ksym; int active_res = -1; int sk_state_res = -1; int __noinline f1(struct __sk_buff *skb) { struct bpf_sock *sk = skb->sk; int *active; if (!sk) return -1; ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_hashmap_full_update_bench' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022 Bytedance */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; #define MAX_ENTRIES 1000 struct { __uint(type, BPF_MAP_TYPE_HASH); __type(key, u32); __type(value, u64); __uint(max_entries,...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/mptcp_sockmap' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "bpf_tracing_net.h" char _license[] SEC("license") = "GPL"; int sk_index; int redirect_idx; int trace_port; int helper_ret; struct { __uint(type, BPF_MAP_TYPE_SOCKMAP); __uint(key_size, sizeof(__u32)); __uint(value_size, sizeof(__u32)); __uint(max_entries, 100); ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/ringbuf_bench' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2020 Facebook #include <stdbool.h> #include <linux/bpf.h> #include <stdint.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_RINGBUF); } ringbuf SEC(".maps"); const volatile int ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_netfilter_ctx' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "vmlinux.h" #include "bpf_misc.h" #include <bpf/bpf_endian.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> SEC("netfilter") __description("netfilter invalid context access, size too short") __failure __msg("invalid bpf_context access") __naked void with...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_xdp_link' 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> char LICENSE[] SEC("license") = "GPL"; SEC("xdp") int xdp_handler(struct xdp_md *xdp) { return 0; } SEC("tc") int tc_handler(struct __sk_buff *skb) { return 0; } ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/getsockname6_prog' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 Google LLC */ #include "vmlinux.h" #include <string.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #include <bpf/bpf_core_read.h> #include "bpf_kfuncs.h" #define REWRITE_ADDRESS_IP6_0 0xfaceb00c #define REWRITE_ADDRESS_IP6_1 0x12345678 #defi...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_tailcall_jit' 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" int main(void); struct { __uint(type, BPF_MAP_TYPE_PROG_ARRAY); __uint(max_entries, 1); __uint(key_size, sizeof(__u32)); __array(values, void (void)); } jmp_table SEC(".maps") = { .values = { [0] ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/btf_dump_test_case_multidim' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) /* * BTF-to-C dumper test for multi-dimensional array output. * * Copyright (c) 2019 Facebook */ /* ----- START-EXPECTED-OUTPUT ----- */ typedef int arr_t[2]; typedef int multiarr_t[3][4][5]; typedef int *ptr_arr_t[6]; typedef int *ptr_multiarr_t[7][8]...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_get_stack_rawtp_err' 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> #define MAX_STACK_RAWTP 10 SEC("raw_tracepoint/sys_enter") int bpf_prog2(void *ctx) { __u64 stack[MAX_STACK_RAWTP]; int error; /* set all the flags which should return -EINVAL */ error = bpf_get_stack(ctx, stack, 0, -1)...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tc_bpf2bpf' 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" __noinline int subprog_tc(struct __sk_buff *skb) { int ret = 1; __sink(skb); __sink(ret); /* let verifier know that 'subprog_tc' can change pointers to skb->data */ bpf_skb_change_proto(skb, 0, 0);...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/btf_dump_test_case_ordering' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) /* * BTF-to-C dumper test for topological sorting of dependent structs. * * Copyright (c) 2019 Facebook */ /* ----- START-EXPECTED-OUTPUT ----- */ struct s1 {}; struct s3; struct s4; struct s2 { struct s2 *s2; struct s3 *s3; struct s4 *s4; }; struc...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/fentry_many_args' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Tencent */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; __u64 test1_result = 0; SEC("fentry/bpf_testmod_fentry_test7") int BPF_PROG(test1, __u64 a, void *b, short c, int d, void *...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/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 <vmlinux.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #define EDEADLK 35 #define ETIMEDOUT 110 struct arr_elem { struct bpf_res_spin_lock lock; }; struct { __ui...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_subprog_precision' 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 <string.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #include <../../../tools/include/linux/filter.h> int vals[] SEC(".data.vals") = {1, 2, 3, 4}; __naked...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/linked_vars2' 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; /* when an extern is defined as both strong and weak, resulting symbol will be strong */ extern bool CONFIG_BPF_SYSCALL _...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tailcall3' 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_PROG_ARRAY); __uint(max_entries, 2); __uint(key_size, sizeof(__u32)); __uint(value_size, sizeof(__u32)); } jmp_table SEC(".maps"); int count = 0; SEC("tc") int classifier_0(struct __sk...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/xdpwall' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include <stdbool.h> #include <stdint.h> #include <linux/stddef.h> #include <linux/if_ether.h> #include <linux/in.h> #include <linux/in6.h> #include <linux/ip.h> #include <linux/ipv6.h> #include <linux/tcp.h> #include <linux/udp.h> #include <lin...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/lru_bug' 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> struct map_value { struct task_struct __kptr_untrusted *ptr; }; struct { __uint(type, BPF_MAP_TYPE_LRU_HASH); __uint(max_entries, 1); __type(key, int); __type(value, struct map_value); } lru_ma...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_module_attach' 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> #include "../test_kmods/bpf_testmod.h" __u32 sz = 0; SEC("?raw_tp/bpf_testmod_test_read") int BPF_PROG(handle_raw_tp, struct t...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_xdp_dynptr' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022 Meta */ #include <stddef.h> #include <string.h> #include <stdbool.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/udp.h> #include <linux/t...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/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 <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "../test_kmods/bpf_testmod_kfunc.h" struct map_value { struct prog_test_ref_kfunc __kptr *ref_ptr; }; struct { __uint(type, B...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_global_func8' 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" __noinline int foo(struct __sk_buff *skb) { return bpf_get_prandom_u32(); } SEC("cgroup_skb/ingress") __success int global_func8(struct __sk_bu...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/pyperf600_iter' 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 STACK_MAX_LEN 600 #define SUBPROGS #define NO_UNROLL #define USE_ITER #include "pyperf.h" ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_arena' 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 <errno.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "bpf_experimental.h" #include "bpf_arena_common.h" #de...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/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 <vmlinux.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> struct bpf_testmod_struct_arg_1 { int a; }; struct bpf_testmod_struct_arg_2 { long a; long b; }; struct bpf_testmod_struct_arg_3 { ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/btf_dump_test_case_namespacing' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) /* * BTF-to-C dumper test validating no name versioning happens between * independent C namespaces (struct/union/enum vs typedef/enum values). * * Copyright (c) 2019 Facebook */ /* ----- START-EXPECTED-OUTPUT ----- */ struct S { int S; int U; }; typed...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/netcnt_prog' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <linux/version.h> #include <bpf/bpf_helpers.h> #include "netcnt_common.h" #define MAX_BPS (3 * 1024 * 1024) #define REFRESH_TIME_NS 100000000 #define NS_PER_SEC 1000000000 struct { __uint(type, BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE); __type(key...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/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 "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_core_read.h> #include "bpf_kfuncs.h" struct { __uint(type, BPF_MAP_TYPE_TASK_STORAGE); __uint(map_flags, BPF_F_NO_PRE...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/freplace_global_func' 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> __noinline int test_ctx_global_func(struct __sk_buff *skb) { volatile int retval = 1; return retval; } SEC("freplace/test_pkt_access") int new_test_pkt_access(struct __sk_buff *skb) { return test_ctx_global_func(skb); } c...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_trace_ext_tracing' 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> __u64 fentry_called = 0; SEC("fentry/test_pkt_md_access_new") int BPF_PROG(fentry, struct sk_buff *skb) { fentry_called = skb->len; return 0; } __u64 fexit_called = 0; SEC("fexit/test_pkt_md_ac...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_ringbuf_write' 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" char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_RINGBUF); } ringbuf SEC(".maps"); /* inputs */ int pid = 0; /* outputs */ long passed = 0; long discarded = 0; SEC("fentry/...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_refcounted_fail__global_subprog' 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"; extern void bpf_task_release(struct task_struct *p) __ksym; __noinline int subprog_release(__u64 *ctx __arg_ctx) { struct task_struct *task = (struct task_struc...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_map_ops' 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_helpers.h> char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_HASH); __uint(max_entries, 1); __type(key, int); __type(value, int); } hash_map SEC("...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_kfunc_dynptr_param' 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 "vmlinux.h" #include <errno.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" extern struct bpf_key *bpf_lookup_s...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_bpf_get_stack' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/bpf_get_stack.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #define MAX_ENTRIES 11 struct test_val { unsigned int index; int foo[MAX_ENTRIES]; }; struct { __uint(type, BPF_MAP_TYPE_ARR...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_ldsx' 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" #include "bpf_arena_common.h" #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ defined(__TARGET_ARCH_arm) || defined(__TARG...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/iters_css_task' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2023 Chuyi Zhou <zhouchuyi@bytedance.com> */ #include "vmlinux.h" #include <errno.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "bpf_experimental.h" char _license[] SEC("license") = "GPL"; struct cgroup *bpf_cgrou...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/crypto_bench' 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_tracing_net.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "bpf_kfuncs.h" #include "crypto_common.h" const ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/task_storage_nodeadlock' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "vmlinux.h" #include <errno.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; extern bool CONFIG_PREEMPTION __kconfig __weak; int nr_get_errs = 0; int nr_del_errs = 0; struct { __uint(type, BPF_MAP_TYPE_TASK_STORAG...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_bounds_deduction' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/bounds_deduction.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" SEC("socket") __description("check deducing bounds from const, 1") __failure __msg("R0 tried to subtract pointer from scalar")...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_verif_scale1' 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/verifier_value_illegal_alu' 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_illegal_alu.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "../../../include/linux/filter.h" #include "bpf_misc.h" #define MAX_ENTRIES 11 struct test_val { unsigned int index; int foo[MAX_ENTRIE...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/rbtree_search' 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> #include "bpf_misc.h" #include "bpf_experimental.h" struct node_data { struct bpf_refcount ref; struct bpf_rb_node r0; struct bpf_rb_node r1; int key0; int key1...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_helper_restricted' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #include <time.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> struct timer { struct bpf_timer t; }; struct lock { struct bpf_spin_lock l; }; struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 1); __type(key, __u32); __type(value, struct timer); ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_iterating_callbacks' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "bpf_misc.h" #include "bpf_experimental.h" struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 8); __type(key, __u32); __type(value, __u64); } map SEC(".maps"); struct { __uint(type, BPF_MAP_TYPE_USER_RINGBUF); __uint(max_entries, 8); } ringbuf SEC("....
Linux kernel'inin 'tools/testing/selftests/bpf/progs/rbtree_btf_fail__add_wrong_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" struct node_data { int key; int data; struct bpf_rb_node node; }; struc...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_array_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/array_access.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #define MAX_ENTRIES 11 struct test_val { unsigned int index; int foo[MAX_ENTRIES]; }; struct { __uint(type, BPF_MAP_TYPE_ARRA...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_spin_lock' 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 <linux/version.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" struct hmap_elem { volatile int cnt; struct bpf_spin_lock lock; int test_padding; }; struct { __uint(type, BPF_MAP_TYPE_HASH); __uint(max_en...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tcp_ca_unsupp_cong_op' 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"; SEC("struct_ops") size_t BPF_PROG(unsupp_cong_op_get_info, struct sock *sk, u32 ext, int *attr, union tcp_cc_info *info) { return 0; } SEC(".struct_ops"...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_deny_namespace' 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 <errno.h> #include <linux/capability.h> typedef struct { unsigned long long val; } kernel_cap_t; struct cred { kernel_cap_t cap_effective; } __attribute__((preserve_access_index)); char...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/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 "bpf_tracing_net.h" char _license[] SEC("license") = "GPL"; __s32 page_size = 0; const char cc_reno[TCP_CA_NAME_MAX] = "reno"; const char cc_cubic[TCP_CA_NAME_MAX] = "cubic"; SEC("cgroup/setsockopt") int sockopt_qos_to_cc(struct bpf...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_udp6' 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_endian.h> char _license[] SEC("license") = "GPL"; #define IPV6_SEQ_DGRAM_HEADER \ " sl " \ "local_address " \ ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_core_reloc_ints' 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_ints { uint8_t u8_field; in...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_map_init' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Tessares SA <http://www.tessares.net> */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> __u64 inKey = 0; __u64 inValue = 0; __u32 inPid = 0; struct { __uint(type, BPF_MAP_TYPE_PERCPU_HASH); __uint(max_entries, 2); __type(key, __u64); __type(value,...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_map_in_map_invalid' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Isovalent, Inc. */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> struct inner { __uint(type, BPF_MAP_TYPE_ARRAY); __type(key, __u32); __type(value, int); __uint(max_entries, 4); }; struct { __uint(type, BPF_MAP_TYPE_ARRAY_OF_MAPS); __uint(max_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tailcall_bpf2bpf_hierarchy3' 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" #include "bpf_test_utils.h" int classifier_0(struct __sk_buff *skb); struct { __uint(type, BPF_MAP_TYPE_PROG_ARRAY); __uint(max_entries, 1); __uint(key_size, sizeof(__u32)); __array(values, void (voi...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_basic_stack' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/basic_stack.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_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tailcall_sleepable' 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" #include "bpf_test_utils.h" struct { __uint(type, BPF_MAP_TYPE_PROG_ARRAY); __uint(max_entries, 1); __uint(key_size, sizeof(__u32)); __array(values, void (void)); } jmp_table SEC(".maps"); SEC("?upro...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_btf_newkv' 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> #include "bpf_legacy.h" struct ipv_counts { unsigned int v4; unsigned int v6; }; struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 4); __type(key, int); __type(value, st...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bind6_prog' 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 <linux/in.h> #include <linux/in6.h> #include <linux/if.h> #include <errno.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #include "bind_prog.h" #define SERV6_IP_0 0xfaceb00c /* face:...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_d_path' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/d_path.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" SEC("fentry/dentry_open") __description("d_path accept") __success __retval(0) __naked void d_path_accept(void) { asm volatile (" \...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/skb_load_bytes' 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"; __u32 load_offset = 0; int test_result = 0; SEC("tc") int skb_process(struct __sk_buff *skb) { char buf[16]; test_result = bpf_skb_load_bytes(skb, load_offset, buf, 10); return 0...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_cc_cubic' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* Highlights: * 1. The major difference between this bpf program and tcp_cubic.c * is that this bpf program relies on `cong_control` rather than * `cong_avoid` in the struct tcp_congestion_ops. * 2. Logic such as tcp_cwnd_reduction, tcp_cong_avoid, and * tcp...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_xdp' 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.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 1); __type(key, int); __type(value, __u64); __uint(map_flags, BPF_F_RDO...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_global_func2' 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" #define MAX_STACK (512 - 3 * 32) static __attribute__ ((noinline)) int f0(int var, struct __sk_buff *skb) { return skb->len; } __attribute__ (...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_bpf_cookie' 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> #include <errno.h> int my_tid; __u64 kprobe_res; __u64 kprobe_multi_res; __u64 kretprobe_res; __u64 uprobe_res; __u64 uretprobe_res; __u64 tp_res; __u64 pe_res; __...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/xdping_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. */ #define KBUILD_MODNAME "foo" #include <stddef.h> #include <string.h> #include <linux/bpf.h> #include <linux/icmp.h> #include <linux/in.h> #include <linux/if_ether.h> #include <linux/if_packet.h> #inclu...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/rbtree_search_kptr' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2026 KylinSoft Corporation. */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #include "bpf_experimental.h" #define NR_NODES 16 struct node_data { int data; }; struct tree_node { struct bpf_rb_node node; u64 key; struct node_data...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_stack_var_off' 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> int probe_res; char input[4] = {}; int test_pid; SEC("tracepoint/syscalls/sys_enter_nanosleep") int probe(void *ctx) { /* This BPF program performs variable-offset reads and writes on a * stack-allocated buffer. */ ch...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/connect4_prog' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2018 Facebook #include <string.h> #include <linux/stddef.h> #include <linux/bpf.h> #include <linux/in.h> #include <linux/in6.h> #include <linux/tcp.h> #include <linux/if.h> #include <errno.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #define S...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/btf__core_reloc_misc' alt sistemi için gerekli C kaynak kodunu implemente et.
```c #include "core_reloc_types.h" void f1(struct core_reloc_misc___a x) {} void f2(struct core_reloc_misc___b x) {} void f3(struct core_reloc_misc_extensible x) {} ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/sockopt_inherit' 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"; #define SOL_CUSTOM 0xdeadbeef #define CUSTOM_INHERIT1 0 #define CUSTOM_INHERIT2 1 #define CUSTOM_LISTENER 2 __s32 page_size = 0; struct sockopt_inherit { __u8 val; }; struct...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_assoc' 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"; int test_pid; /* Programs associated with st_ops_map_a */ #define MAP_A_MAGIC ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_unpriv' 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 <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "../../../include/linux/filter.h" #include "bpf_misc.h" #define BPF_SK_LOOKUP(func) \ /* struct bpf_sock_tuple tuple = {} */ \ "r2 = 0;" \ "*(u3...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tailcall_bpf2bpf_hierarchy2' 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" #include "bpf_test_utils.h" int classifier_0(struct __sk_buff *skb); int classifier_1(struct __sk_buff *skb); struct { __uint(type, BPF_MAP_TYPE_PROG_ARRAY); __uint(max_entries, 2); __uint(key_size, s...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_core_reloc_arrays' 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_arrays_output { int a2; int ...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/task_local_data.bpf' 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_BPF_H #define __TASK_LOCAL_DATA_BPF_H /* * Task local data is a library that facilitates sharing per-task data * between user space and bpf programs. * * * USAGE * * A TLD, an entry of data in task local data, first needs t...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cpumask_failure' 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_misc.h" #include "cpumask_common.h" char _license[] SEC("license") = "GPL"; struct kptr_nested_array_2 { struct bpf_cpu...