instruction
stringlengths
82
202
input
stringclasses
1 value
output
stringlengths
73
23.9M
Linux kernel'inin 'tools/testing/selftests/bpf/progs/recvmsg4_prog' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/stddef.h> #include <linux/bpf.h> #include <linux/in.h> #include <sys/socket.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #include <bpf_sockopt_helpers.h> #define SERV4_IP 0xc0a801feU /* 192.168.1.254 */ #define SERV4_PORT 4040 SEC("cgroup/re...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_sockmap_change_tail' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 ByteDance */ #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) struct { __uint(type, BPF_MAP_TYPE_SOCKMAP); __uint(max_entries, 1); __type(key, int); __typ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_qdisc_fail__incompl_ops' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include "bpf_experimental.h" #include "bpf_qdisc_common.h" char _license[] SEC("license") = "GPL"; SEC("struct_ops") int BPF_PROG(bpf_qdisc_test_enqueue, struct sk_buff *skb, struct Qdisc *sch, struct bpf_sk_buff_ptr *to_free) { bpf_qdisc_skb_drop...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_sockmap_invalid_update' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2020 Cloudflare #include "vmlinux.h" #include <bpf/bpf_helpers.h> struct { __uint(type, BPF_MAP_TYPE_SOCKMAP); __uint(max_entries, 1); __type(key, __u32); __type(value, __u64); } map SEC(".maps"); SEC("sockops") int bpf_sockmap(struct bpf_sock_ops *skops) ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_sdiv' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <limits.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_s3...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/freplace_attach_probe' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2020 Facebook #include <linux/ptrace.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #define VAR_NUM 2 struct hmap_elem { struct bpf_spin_lock lock; int var[VAR_NUM]; }; struct { __uint(type, BPF_MAP_TYPE_HASH); __uint...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_refcounted' 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"; __attribute__((nomerge)) extern void bpf_task_release(struct task_struct *p) __ksym; /* This is a test BPF program that uses struct_ops to access a referenced *...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/iters_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 <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "bpf_experimental.h" char _license[] SEC("license") = "GPL"; pid_t target_pid; int procs_cnt, threads_cn...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_uprobe' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Hengqi Chen */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> pid_t my_pid = 0; int test1_result = 0; int test2_result = 0; int test3_result = 0; int test4_result = 0; SEC("uprobe/./liburandom_read.so:urandlib_api_sameoff...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/find_vma_fail2' 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> char _license[] SEC("license") = "GPL"; struct callback_ctx { int dummy; }; static long write_task(struct task_struct *task, struct vm_area_struct *vma, struct callback_ctx *data) { ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/task_work' 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 <string.h> #include <stdbool.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "errno.h" char _license[] SEC("license") = "GPL"; const void *u...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bloom_filter_bench' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include <errno.h> #include <linux/bpf.h> #include <stdbool.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; struct bpf_map; __u8 rand_vals[2500000]; const __u32 nr_rand_bytes = 2500000; struct {...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_ksyms' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2019 Facebook */ #include <stdbool.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> __u64 out__bpf_link_fops = -1; __u64 out__bpf_link_fops1 = -1; __u64 out__btf_size = -1; __u64 out__per_cpu_start = -1; extern const void bpf_link_fops __ksym; extern co...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_lookup_and_delete' 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> __u32 set_pid = 0; __u64 set_key = 0; __u64 set_value = 0; struct { __uint(type, BPF_MAP_TYPE_HASH); __uint(max_entries, 2); __type(key, __u64); __type(value, __u64); } hash_map SEC(".maps"); SEC("tp/syscalls/sys_enter_ge...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bprm_opts' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Copyright 2020 Google LLC. */ #include <linux/bpf.h> #include <errno.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_TASK_STORAGE); __uint(map_flags, BPF_F_NO_PREALLOC); __type(...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/uprobe_multi_session' 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"; __u64 uprobe_multi_func_1_addr = 0; __u64 uprobe_multi_func_2_addr = 0; __u64 uprobe_multi_func_3_addr = 0; __u64 ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bind4_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 SERV4_IP 0xc0a801feU /* 192.16...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_subprogs_extable' 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> struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 8); __type(key, __u32); __type(value, __u64); } test_array SEC(".maps"); unsigned int triggered; static __u64 test_cb(struct bpf_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_xdp_with_devmap_frags_helpers' 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_DEVMAP); __uint(key_size, sizeof(__u32)); __uint(value_size, sizeof(struct bpf_devmap_val)); __uint(max_entries, 4); } dm_ports SEC(".maps"); /* valid program on DEVMAP entry via SEC nam...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_cgroup_inv_retcode' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/cgroup_inv_retcode.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" SEC("cgroup/sock") __description("bpf_exit with invalid return code. test1") __failure __msg("smin=0 smax=4294967295 should ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/access_map_in_map' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2023. Huawei Technologies Co., Ltd */ #include <linux/bpf.h> #include <time.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" 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_sockmap_redir' 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(".maps") struct { __uint(type, BPF_MAP_TYPE_SOCKMAP); __uint(max_entries, 1); __type(key, __u32); __type(value, __u64); } nop_map, sock_map; SEC(".maps") struct { __uint(type, BPF_MAP_TYPE_SOCK...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/wq' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 Benjamin Tissoires */ #include "bpf_experimental.h" #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #include "../test_kmods/bpf_testmod_kfunc.h" char _license[] SEC("license") = "GPL"; struct hmap_elem { int counter; struct bpf_timer timer; /* unus...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/xdp_redirect_map' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/if_ether.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> struct { __uint(type, BPF_MAP_TYPE_DEVMAP); __uint(max_entries, 8); __uint(key_size, sizeof(int)); __uint(value_size, sizeof(int)); } tx_port SEC(".maps"); SEC("xd...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_d_path' 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 MAX_PATH_LEN 128 #define MAX_FILES 7 pid_t my_pid = 0; __u32 cnt_stat = 0; __u32 cnt_close = 0; char paths_stat[MAX_FILES][MAX_PATH_LEN] = {}; char paths_close[MAX_FILES][MAX_PATH_LEN] = ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_pinning_htab' 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> char _license[] SEC("license") = "GPL"; struct timer_val { struct bpf_timer timer; }; struct { __uint(type, BPF_MAP_TYPE_HASH); __type(key, __u32); __type(value, struct timer_val); __uint(max_entries, 1); } timer_preallo...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_mod_race' 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> const volatile struct { /* thread to activate trace programs for */ pid_t tgid; /* return error from __init function */ int inject_error; /* uffd monitored range start address */ void *fault_ad...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_regalloc' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/regalloc.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_HASH); ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/local_storage_rcu_tasks_trace_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" struct { __uint(type, BPF_MAP_TYPE_TASK_STORAGE); __uint(map_flags, BPF_F_NO_PREALLOC); __type(key, int); __type(value, int); } task_storag...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/err' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ #ifndef __ERR_H__ #define __ERR_H__ #define MAX_ERRNO 4095 #define IS_ERR_VALUE(x) (unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO #define __STR(x) #x #define set_if_not_errno_or_zero(x, y) \ ({ \ asm volatile ("if %0 s< -4095 goto +1\n" \ "if %0 s...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cgroup_preorder' 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"; unsigned int idx; __u8 result[4]; SEC("cgroup/getsockopt") int child(struct bpf_sockopt *ctx) { if (idx < 4) result[idx++...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_lsm' 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" SEC("lsm/file_permission") __description("lsm bpf prog with -4095~0 retval. test 1") __success __naked int errno_zero_retval_test1(void *ctx) { asm volatile ( "r0 = 0;" "exi...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_helper_value_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/helper_value_access.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" struct other_val { long long foo; long long bar; }; struct { __uint(type, BPF_MAP_TYPE_HASH); __uint(max_entries, 1); ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_tcp_estats' 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. */ /* This program shows clang/llvm is able to generate code pattern * like: * _tcp_s...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/kprobe_multi_session' 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"; extern const void bpf_fentry_test1 __ksym; extern const void bpf_fentry_test2 __ksym; ext...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_arena_large' 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_misc.h" #include "bpf_experimental.h" #include "bpf_arena_common.h" #define ARENA_SIZE (1u...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_test_kern4' 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 map1_id = 0, map2_id = 0; __u32 map1_accessed = 0, map2_accessed = 0; __u64 map1_seqnum = 0, map2_seqnum1 = 0, map2_seqnum2 = 0; volatile const __...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_async_cb_context' 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/bpf_tracing.h> #include "bpf_misc.h" #include "bpf_experimental.h" char _license[] SEC("license") = "GPL"; /* Timer tests */ struct timer_elem { str...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_call_large_imm' 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 call_happened = 0; /* * 32765 is the exact minimum number of padding instructions needed to * trigger the verifier failure, because: * 1. Counting the wrapper instructions around the padding block...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/kprobe_multi_sleepable' 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> void *user_ptr = 0; SEC("kprobe.multi") int handle_kprobe_multi_sleepable(struct pt_regs *ctx) { int a, err; err = bpf_copy_from_user(&a, sizeof(a), user_ptr); barrier_var(a); return err; } S...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_xdp_noinline' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2017 Facebook #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/ip.h> #include <linux/ipv6.h> #include <linux/icmp.h> #include <linux/i...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_align' 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. */ /* Converted from tools/testing/selftests/bpf/prog_tests/align.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" /* Four tests of known constants. These aren't staggeringly * interesti...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/livepatch_trampoline' 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 <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> int fentry_hit; int fexit_hit; int my_pid; SEC("fentry/cmdline_proc_show") int BPF_PROG(fentry_cmdline) { if (my_pid != (bpf_get_cur...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/freplace_void' 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/foo") void test_freplace_void(struct __sk_buff *skb) { } char _license[] SEC("license") = "GPL"; ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_probe_user' 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" struct test_pro_bss { struct sockaddr_in old; __u32 test_pid; }; struct test_pro_bss bss; static int handle_sys_connect_common(struct sockaddr...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_sysctl_loop1' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Facebook #include <stdint.h> #include <string.h> #include <linux/stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_compiler.h" #include "bpf_misc.h" /* tcp_mem sysctl has only 3 ints, but this test is doing TCP_MEM_LOOPS */ #d...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/fexit_test' 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> char _license[] SEC("license") = "GPL"; __u64 test1_result = 0; SEC("fexit/bpf_fentry_test1") int BPF_PROG(test1, int a, int ret) { test1_result = a == 1 && ret ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/kfunc_call_destructive' 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" SEC("tc") int kfunc_destructive_test(void) { bpf_kfunc_call_test_destructive(); return 0; } char _license[] SEC("license") = "GPL"; ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/ip_check_defrag' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #include "bpf_tracing_net.h" #define NF_DROP 0 #define NF_ACCEPT 1 #define ETH_P_IP 0x0800 #define ETH_P_IPV6 0x86DD #define IP_MF 0x2000 #define IP_OFFSET 0x1FFF #define NEXTHDR_FRAGMENT...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/for_each_hash_modify' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2025 Intel Corporation */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_HASH); __uint(max_entries, 128); __type(key, __u64); __type(value, __u64); } hashmap SEC(".maps"); stati...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_parse_tcp_hdr_opt' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* This parsing logic is taken from the open source library katran, a layer 4 * load balancer. * * This code logic using dynptrs can be found in test_parse_tcp_hdr_opt_dynptr.c * * https://github.com/facebookincubator/katran/blob/main/katran/lib/bpf/pckt_parsing.h */ #in...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/lpm_trie_map' 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> #define MAX_ENTRIES 100000000 struct trie_key { __u32 prefixlen; __u32 data; }; struct { __uint(type, BPF_MAP_TYPE_LPM_TRIE); __type(key, struct trie_key); __type(value, __u32); __uint(map_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/missed_tp_recursion' 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"; /* * No tests in here, just to trigger 'bpf_fentry_test*' * through tracing test_run */ SEC("fentry/bpf_modify_return_test") int BPF_PROG(trigger) { retur...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_bounds' 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.c */ #include <linux/bpf.h> #include <../../../include/linux/filter.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); ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_tcp_nogpl' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "bpf_tracing_net.h" #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "X"; SEC("struct_ops") void BPF_PROG(nogpltcp_init, struct sock *sk) { } SEC(".struct_ops") struct tcp_congestion_ops bpf_nogpltcp = { .init = (void *)nogpltcp_init, .name ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cgrp_ls_sleepable' 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_misc.h" char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_CGRP_STORAGE); __uint(map_flags, BPF_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_jit_inline' 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_misc.h" SEC("fentry/bpf_fentry_test1") __success __retval(0) __arch_x86_64 __jited(" addq %gs:{{.*}}, %rax") __arch_arm64 __jited(" mrs x7, SP_EL0") int inline_bpf_get_current_task(void) { bpf_get_current_task();...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_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 "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/usdt.bpf.h> int my_pid; int usdt0_called; u64 usdt0_cookie; int usdt0_arg_cnt; int usdt0_arg_ret; int usdt0_arg_size; SEC("usdt") int usdt0(struct pt...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_div0' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/div0.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" SEC("socket") __description("DIV32 by 0, zero check 1") __success __success_unpriv __retval(42) __naked void by_0_zero_check_1_1(void) { ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/kfunc_module_order' 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> extern int bpf_test_modorder_retx(void) __ksym; extern int bpf_test_modorder_rety(void) __ksym; SEC("classifier") int call_kfunc_xy(struct __sk_buff *skb) { int ret1, ret2; ret1 = bpf_test_modorder_retx(); ret2 = bpf_test...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_sock_fields' 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 <netinet/in.h> #include <stdbool.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> enum bpf_linum_array_idx { EGRESS_LINUM_IDX, INGRESS_LINUM_IDX, READ_SK_DST_PORT_LINUM_IDX, __NR_BPF_LINUM_ARRAY_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_skb_helpers' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #define TEST_COMM_LEN 16 struct { __uint(type, BPF_MAP_TYPE_CGROUP_ARRAY); __uint(max_entries, 1); __type(key, u32); __type(value, u32); } cgroup_map SEC(".maps"); char _license[] SEC("lice...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/map_excl' 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 <time.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" struct { __uint(type, BPF_MAP_TYPE_ARRAY); __type(key, __u32); __type(value, __u32); __uint(max_entries, 1); } excl_map SEC(".maps"); char _lic...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/connect_ping' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * Copyright 2022 Google LLC. */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #include <netinet/in.h> #include <sys/socket.h> /* 2001:db8::1 */ #define BINDADDR_V6 { { { 0x20,0x01,0x0d,0xb8,0,0,0,0,0,0,0,0,0,0,0,1 } } } __u32 do_bi...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_kfunc_prog_types' 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/bpf_helpers.h> #include "bpf_misc.h" #include "cgrp_kfunc_common.h" #include "cpumask_common.h" #include "task_kfunc_common.h" char _license[] SEC("li...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/inner_array_lookup' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #include <linux/bpf.h> #include <bpf/bpf_helpers.h> struct inner_map { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 5); __type(key, int); __type(value, int); } inner_map1 SEC(".maps"); struct outer_map { __uint(type, BPF_MAP_TYPE_HASH_OF_MAPS); __uint(max_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tailcall_bpf2bpf_hierarchy1' 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_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)); } jmp_table SEC(".maps"); int...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_gotol' 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" #ifdef CAN_USE_GOTOL SEC("socket") __description("gotol, small_imm") __success __success_unpriv __retval(1) __naked void gotol_small_imm(void) { asm volatile (" \ call %[bpf_ktime_get_ns]; \ if...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/strncmp_test' 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 <stdbool.h> #include <linux/types.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #define STRNCMP_STR_SZ 8 const char target[STRNCMP_STR_SZ] = "EEEEEEE"; char str[STRNCMP_STR_SZ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/sk_bypass_prot_mem' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright 2025 Google LLC */ #include "bpf_tracing_net.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <errno.h> extern int tcp_memory_per_cpu_fw_alloc __ksym; extern int udp_memory_per_cpu_fw_alloc __ksym; int nr_cpus; bool tcp_activated, udp_activat...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_tc_peer' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <stdint.h> #include <stdbool.h> #include <linux/bpf.h> #include <linux/stddef.h> #include <linux/pkt_cls.h> #include <linux/if_ether.h> #include <linux/ip.h> #include <bpf/bpf_helpers.h> volatile const __u32 IFINDEX_SRC; volatile const __u32 IFINDEX_DST; static cons...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/btf_dump_test_case_syntax' 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 majority of C syntax quirks. * * Copyright (c) 2019 Facebook */ /* ----- START-EXPECTED-OUTPUT ----- */ enum e1 { A = 0, B = 1, }; enum e2 { C = 100, D = 4294967295, E = 0, }; typedef enum e2 e2_t; typedef enum { F =...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/get_func_ip_fsession_test' 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"; __u64 test1_entry_result = 0; __u64 test1_exit_result = 0; SEC("fsession/bpf_fentry_test1") int BPF_PROG(test1, int a) { __u64 addr = bpf_get_func_ip(ctx); ...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/cg_storage_multi' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0-only */ #ifndef __PROGS_CG_STORAGE_MULTI_H #define __PROGS_CG_STORAGE_MULTI_H struct cgroup_value { __u32 egress_pkts; __u32 ingress_pkts; }; #endif ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_perf_link' 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> int run_cnt = 0; SEC("perf_event") int handler(struct pt_regs *ctx) { __sync_fetch_and_add(&run_cnt, 1); return 0; } char _license[] SEC("license") = "GPL"; ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_bitfield_write' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <stdint.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> #include "bpf_misc.h" struct core_reloc_bitfields { /* unsigned bitfields */ uint8_t ub1: 1; uint8_t ub2: 2; uint32_t ub7: 7; /* signed bitfields */ int8_t sb4: 4;...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/normal_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 <vmlinux.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #include "bpf_experimental.h" struct node_data { __u64 data; struct bpf_list_node node; }; struct map_value { struct ...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/nested_trust_common' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ /* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */ #ifndef _NESTED_TRUST_COMMON_H #define _NESTED_TRUST_COMMON_H #include <stdbool.h> bool bpf_cpumask_test_cpu(unsigned int cpu, const struct cpumask *cpumask) __ksym; __u32 bpf_cpumask_first_zero(const struct cpu...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_maybe_null' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ #include <vmlinux.h> #include <bpf/bpf_tracing.h> #include "../test_kmods/bpf_testmod.h" char _license[] SEC("license") = "GPL"; pid_t tgid = 0; /* This is a test BPF program that uses struct_ops to access an argum...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/bpf_iter_test_kern_common' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ /* Copyright (c) 2020 Facebook */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; int count = 0; SEC("iter/task") int dump_task(struct bpf_iter__task *ctx) { struct seq_file *seq = ctx->meta->seq; char c; if (count < 4) { c = ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_runtime_jit' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/runtime_jit.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" void dummy_prog_42_socket(void); void dummy_prog_24_socket(void); void dummy_prog_loop1_socket(void); void dummy_prog_loop2_socket(...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_sockmap_skb_verdict_attach' 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_SOCKMAP); __uint(max_entries, 2); __type(key, __u32); __type(value, __u64); } sock_map SEC(".maps"); SEC("sk_skb/verdict") int prog_skb_verdict(struct __sk_buff *skb) { return SK_DROP; } ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_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 "vmlinux.h" #include <bpf/bpf_tracing.h> char tp_name[128]; SEC("lsm.s/bpf") int BPF_PROG(lsm_run, int cmd, union bpf_attr *attr, unsigned int size, bool kernel) { switch (cmd) { case BPF_RAW_TRACEPOINT_OP...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_tcp_custom_syncookie' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright Amazon.com Inc. or its affiliates. */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #include "bpf_tracing_net.h" #include "bpf_kfuncs.h" #include "test_siphash.h" #include "test_tcp_custom_syncookie.h" #include "bpf_misc.h" #define...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/task_kfunc_success' 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_experimental.h" #include "task_kfunc_common.h" char _license[] SEC("license") = "GPL"; int err, pid; /* Prototype fo...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/sock_addr_kern' 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 <bpf/bpf_helpers.h> #include "../test_kmods/bpf_testmod_kfunc.h" SEC("syscall") int init_sock(struct init_sock_args *args) { bpf_kfunc_init_sock(args); return 0; } SEC("syscall") int close_sock(void *ctx) { ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_d_path_check_types' 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> extern const int bpf_prog_active __ksym; struct { __uint(type, BPF_MAP_TYPE_RINGBUF); __uint(max_entries, 1 << 12); } ringbuf SEC(".maps"); SEC("fentry/security_inode_getattr") int BPF_PROG(d_pa...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_typedef' 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_misc.h" SEC("fentry/bpf_fentry_test_sinfo") __description("typedef: resolve") __success __retval(0) __naked void resolve_typedef(void) { asm volatile (" \ r1 = *(u64 *)(r1 +0); \ r2 = *(u64 *)(r1 +%[frag...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/test_siphash' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright Amazon.com Inc. or its affiliates. */ #ifndef _TEST_SIPHASH_H #define _TEST_SIPHASH_H /* include/linux/bitops.h */ static inline u64 rol64(u64 word, unsigned int shift) { return (word << (shift & 63)) | (word >> ((-shift) & 63)); } /* include/linux/siphash.h */ ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_bpf_trap' 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" #if __clang_major__ >= 21 && 0 SEC("socket") __description("__builtin_trap with simple c code") __failure __msg("unexpected __bpf_trap() due to ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/fsession_test' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2025 ChinaTelecom */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; __u64 test1_entry_result = 0; __u64 test1_exit_result = 0; SEC("fsession/bpf_fentry_test1") int BPF_PROG(test1, int a, ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_legacy_printk' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include <linux/bpf.h> #define BPF_NO_GLOBAL_DATA #include <bpf/bpf_helpers.h> char LICENSE[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_ARRAY); __type(key, int); __type(value, int); __uint(max_entries, 1); } my_pid_map SE...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_parse_tcp_hdr_opt_dynptr' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* This logic is lifted from a real-world use case of packet parsing, used in * the open source library katran, a layer 4 load balancer. * * This test demonstrates how to parse packet contents using dynptrs. The * original code (parsing without dynptrs) can be found in test...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/file_reader' 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 <string.h> #include <stdbool.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "errno.h" char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_ARRAY)...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_core_reloc_existence' 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_existence_output { int a_exis...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_global_subprogs' 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> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "xdp_metadata.h" #include "bpf_kfuncs.h" #include "err.h" /* The compiler may be able to detect the acces...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/pyperf180' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Facebook #define STACK_MAX_LEN 180 /* llvm upstream commit at clang18 * https://github.com/llvm/llvm-project/commit/1a2e77cf9e11dbf56b5720c607313a566eebb16e * changed inlining behavior and caused compilation failure as some branch * target distance ex...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/percpu_alloc_cgrp_local_storage' alt sistemi için gerekli C kaynak kodunu implemente et.
```c #include "bpf_experimental.h" struct val_t { long b, c, d; }; struct elem { long sum; struct val_t __percpu_kptr *pc; }; struct { __uint(type, BPF_MAP_TYPE_CGRP_STORAGE); __uint(map_flags, BPF_F_NO_PREALLOC); __type(key, int); __type(value, struct elem); } cgrp SEC(".maps"); const volatile int nr_cpus; ...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/cpumask_common' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ /* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */ #ifndef _CPUMASK_COMMON_H #define _CPUMASK_COMMON_H #include "errno.h" #include <stdbool.h> /* Should use BTF_FIELDS_MAX, but it is not always available in vmlinux.h, * so use the hard-coded number as a workaro...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_raw_tp_test_run' 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> __u32 count = 0; __u32 on_cpu = 0xffffffff; SEC("raw_tp/task_rename") int BPF_PROG(rename, struct task_struct *task, char *comm) { count++; if ((__u64) task == ...