instruction
stringlengths
82
202
input
stringclasses
1 value
output
stringlengths
73
23.9M
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/bpftool_helpers' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0-only */ #pragma once #include <stdlib.h> #include <stdio.h> #include <stdbool.h> #define MAX_BPFTOOL_CMD_LEN (256) int run_bpftool_command(char *args); int get_bpftool_command_output(char *args, char *output_buf, size_t output_max_len); ```
Linux kernel'inin 'tools/testing/selftests/bpf/jit_disasm_helpers' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) #include <bpf/bpf.h> #include <bpf/libbpf.h> #include <test_progs.h> #ifdef HAVE_LLVM_SUPPORT #include <llvm-c/Core.h> #include <llvm-c/Disassembler.h> #include <llvm-c/Target.h> #include <llvm-c/TargetMachine.h> /* The intent is to use get_jited_program_te...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/xsk' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */ /* * AF_XDP user-space access library. * * Copyright (c) 2018 - 2019 Intel Corporation. * Copyright (c) 2019 Facebook * * Author(s): Magnus Karlsson <magnus.karlsson@intel.com> */ #ifndef __XSK_H #define __XSK_H #include <stdio.h> #include <stdint...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/sysctl_helpers' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ #ifndef __SYSCTL_HELPERS_H #define __SYSCTL_HELPERS_H int sysctl_set(const char *sysctl_path, char *old_val, const char *new_val); int sysctl_set_or_fail(const char *sysctl_path, char *old_val, const char *new_val); #endif ```
Linux kernel'inin 'tools/testing/selftests/bpf/map_tests/lpm_trie_map_batch_ops' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <arpa/inet.h> #include <linux/bpf.h> #include <netinet/in.h> #include <stdio.h> #include <errno.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <bpf/bpf.h> #include <bpf/libbpf.h> #include <test_maps.h> struct test_lpm_key { __u32 prefix; s...
Linux kernel'inin 'tools/testing/selftests/bpf/map_tests/map_in_map_batch_ops' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <errno.h> #include <string.h> #include <unistd.h> #include <bpf/bpf.h> #include <bpf/libbpf.h> #include <test_maps.h> #define OUTER_MAP_ENTRIES 10 static __u32 get_map_id_from_fd(int map_fd) { struct bpf_map_info map_info = {}; uint32_t info_le...
Linux kernel'inin 'tools/testing/selftests/bpf/map_tests/sk_storage_map' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2019 Facebook */ #include <linux/compiler.h> #include <linux/err.h> #include <sys/resource.h> #include <sys/socket.h> #include <sys/types.h> #include <linux/btf.h> #include <unistd.h> #include <signal.h> #include <errno.h> #include <string.h> #include <pthread...
Linux kernel'inin 'tools/testing/selftests/bpf/map_tests/map_percpu_stats' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Isovalent */ #include <errno.h> #include <unistd.h> #include <pthread.h> #include <bpf/bpf.h> #include <bpf/libbpf.h> #include <bpf_util.h> #include <test_maps.h> #include "map_percpu_stats.skel.h" #define MAX_ENTRIES 16384 #define MAX_ENTRIES_HASH_O...
Linux kernel'inin 'tools/testing/selftests/bpf/map_tests/array_map_batch_ops' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <errno.h> #include <string.h> #include <unistd.h> #include <bpf/bpf.h> #include <bpf/libbpf.h> #include <test_maps.h> static int nr_cpus; static void map_batch_update(int map_fd, __u32 max_entries, int *keys, __s64 *values, bool is_pcpu) ...
Linux kernel'inin 'tools/testing/selftests/bpf/map_tests/lpm_trie_map_basic_ops' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Randomized tests for eBPF longest-prefix-match maps * * This program runs randomized tests against the lpm-bpf-map. It implements a * "Trivial Longest Prefix Match" (tlpm) based on simple, linear, singly linked * lists. The implementation should be pretty straightforwa...
Linux kernel'inin 'tools/testing/selftests/bpf/map_tests/lpm_trie_map_get_next_key' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #define _GNU_SOURCE #include <linux/bpf.h> #include <stdio.h> #include <stdbool.h> #include <unistd.h> #include <errno.h> #include <stdlib.h> #include <string.h> #include <pthread.h> #include <bpf/bpf.h> #include <bpf/libbpf.h> #include <test_maps.h> struct test_lpm_key { _...
Linux kernel'inin 'tools/testing/selftests/bpf/map_tests/htab_map_batch_ops' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2019 Facebook */ #include <stdio.h> #include <errno.h> #include <string.h> #include <unistd.h> #include <bpf/bpf.h> #include <bpf/libbpf.h> #include <bpf_util.h> #include <test_maps.h> static void map_batch_update(int map_fd, __u32 max_entries, int *keys, ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_subprogs' alt sistemi için gerekli C kaynak kodunu implemente et.
```c #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> const char LICENSE[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 1); __type(key, __u32); __type(value, __u64); } array SEC(".maps"); __noinline int sub1(int x) { int key = 0; bpf_ma...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_ctx_ptr_param' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Verifier tests for single- and multi-level pointer parameter handling * Copyright (c) 2026 CrowdStrike, Inc. */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" SEC("fentry/bpf_fentry_test_ppvoid") __description("fe...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tailcall4' 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, 3); __uint(key_size, sizeof(__u32)); __uint(value_size, sizeof(__u32)); } jmp_table SEC(".maps"); int selector = 0; #define TAIL_FUNC(x) \ SEC("tc"...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/arena_strsearch' 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_experimental.h" struct { __uint(type, BPF_MAP_TYPE_ARENA); __uint(map_flags, BPF_F_MMAPABLE); __uint(max_entries, 100); /* number of pages */ } arena SEC(".maps"); #include "bpf...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/sk_storage_omem_uncharge' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Facebook */ #include "vmlinux.h" #include "bpf_tracing_net.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_core_read.h> void *sk_ptr = NULL; int cookie_found = 0; __u64 cookie = 0; __u32 omem = 0; struct { __uint(type, BPF_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/xsk_xdp_progs' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022 Intel */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <linux/if_ether.h> #include <linux/ip.h> #include <linux/errno.h> #include "xsk_xdp_common.h" struct { __uint(type, BPF_MAP_TYPE_XSKMAP); __uint(max_entries, 2); __uint(key_size, siz...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/linked_maps1' 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> struct my_key { long x; }; struct my_value { long x; }; struct { __uint(type, BPF_MAP_TYPE_HASH); __type(key, struct my_key); __type(value, struct my_value); _...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/uprobe_multi_bench' 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> char _license[] SEC("license") = "GPL"; int count; SEC("uprobe.multi/./uprobe_multi:uprobe_multi_func_*") int uprobe_bench(struct pt_regs *ctx) { count++; return 0; } ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/freplace_connect4' alt sistemi için gerekli C kaynak kodunu implemente et.
```c #include <linux/stddef.h> #include <linux/ipv6.h> #include <linux/bpf.h> #include <linux/in.h> #include <sys/socket.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> SEC("freplace/do_bind") int new_do_bind(struct bpf_sock_addr *ctx) { struct sockaddr_in sa = {}; bpf_bind(ctx, (struct sockaddr *)&sa...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_core_reloc_size' 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_size_output { int int_sz; in...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/pyperf600_nounroll' 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 600 #define NO_UNROLL #include "pyperf.h" ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/linked_funcs2' 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 <bpf/bpf_core_read.h> #include "bpf_misc.h" /* weak and shared between both files */ const volatile int my_tid __weak; long syscall_id __weak; int output_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_core_reloc_type_id' 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 = {}; /* some types a...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_meta_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/meta_access.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" SEC("xdp") __description("meta access, test1") __success __retval(0) __naked void meta_access_test1(void) { asm volatile (" \ ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/fentry_recursive_target' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Red Hat, Inc. */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; /* Dummy fentry bpf prog for testing fentry attachment chains. It's going to be * a start of the chain. */ SEC("fen...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/btf_dump_test_case_padding' 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 implicit and explicit padding between fields and * at the end of a struct. * * Copyright (c) 2019 Facebook */ /* ----- START-EXPECTED-OUTPUT ----- */ struct padded_implicitly { int a; long b; char c; }; /* ------ END-EX...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/dynptr_fail' 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 <stdbool.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <linux/if_ether.h> #include "bpf_misc.h" #include "bpf_kfuncs.h" char _license[] SEC("license...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/syscall' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include <linux/stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <../../../tools/include/linux/filter.h> #include <linux/btf.h> #include <string.h> #include <errno.h> #include "bpf_misc.h" char...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/async_stack_depth' 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" struct hmap_elem { struct bpf_timer timer; }; struct { __uint(type, BPF_MAP_TYPE_HASH); __uint(max_entries, 64); __type(key, int); __type(value, struct hmap_elem); } hmap SEC(".maps"); __attribute__...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/sockmap_verdict_prog' alt sistemi için gerekli C kaynak kodunu implemente et.
```c #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #include "bpf_misc.h" struct { __uint(type, BPF_MAP_TYPE_SOCKMAP); __uint(max_entries, 20); __type(key, int); __type(value, int); } sock_map_rx SEC(".maps"); struct { __uint(type, BPF_MAP_TYPE_SOCKMAP); __uint(max_entries, 20);...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/kfunc_implicit_args' 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_misc.h" extern int bpf_kfunc_implicit_arg(int a) __weak __ksym; extern int bpf_kfunc_implicit_arg_impl(int a, struct bpf_prog_aux *aux) __weak __ksym; ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_tunnel_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2016 VMware * Copyright (c) 2016 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 "vmlinux.h" #...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/loop1' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Facebook #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; SEC("raw_tracepoint/kfree_skb") int nested_loops(volatile struct pt_regs* ctx) { int i, j, sum = 0, m; for (j = 0; j < 300; ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_obj_id' 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 <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, __u32); __type(value, __u64); } test_map_id SEC(".maps"); SE...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_xdp_devmap_helpers' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* fails to load without expected_attach_type = BPF_XDP_DEVMAP * because of access to egress_ifindex */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> SEC("xdp") int xdpdm_devlog(struct xdp_md *ctx) { char fmt[] = "devmap redirect: dev %u -> dev %u len %u\n"; void *dat...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_sockmap_strp' 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> int verdict_max_size = 10000; struct { __uint(type, BPF_MAP_TYPE_SOCKMAP); __uint(max_entries, 20); __type(key, int); __type(value, int); } sock_map SEC(".maps"); SEC("sk_skb/stream_verdict") in...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_value_adj_spill' 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_adj_spill.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_H...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_private_stack_recur' 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 "../test_kmods/bpf_testmod.h" char _license[] SEC("license") = "GPL"; void bpf_testmod_ops3_call_test_1(void) __ksym; int val_i, val_j; __noinline static int subprog2(int *a, int *b) { ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_endian' 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_endian.h> #define IN16 0x1234 #define IN32 0x12345678U #define IN64 0x123456789abcdef0ULL __u16 in16 = 0; __u32 in32 = 0; __u64 in64 = 0; __u16 out16 = 0; __u32 out32 = 0; _...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_cgroup_storage' 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_storage.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "../../../include/linux/filter.h" #include "bpf_misc.h" struct { __uint(type, BPF_MAP_TYPE_CGROUP_STORAGE); __uint(max_entries, 0); __type...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_private_stack' 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 "../test_kmods/bpf_testmod.h" char _license[] SEC("license") = "GPL"; void bpf_testmod_ops3_call_test_2(void) __ksym; int val_i, val_j; __noinline static int subprog2(int *a, int *b) { ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_kernel_flag' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2025 Microsoft Corporation * * Author: Blaise Boscaccy <bboscaccy@linux.microsoft.com> */ #include "vmlinux.h" #include <errno.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; __u32 monitored_tid; SE...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_helper_restricted' 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_restricted.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" struct val { int cnt; struct bpf_spin_lock l; }; struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 1); __t...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/pro_epilogue' 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"; void __kfunc_btf_r...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_xdp_pull_data' 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> int xdpf_sz; int sinfo_sz; int data_len; int pull_len; #define XDP_PACKET_HEADROOM 256 SEC("xdp.frags") int xdp_find_sizes(struct xdp_md *ctx) { xdpf_sz = sizeof(struct xdp_frame); sinfo_sz = __PAGE_SIZE - XDP_PACKET_HEADRO...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/file_reader_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 <string.h> #include <stdbool.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; int err; void *user_ptr; SEC("lsm/file_open") __failure __ms...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/get_func_ip_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"; extern int bpf_fentry_test1(int a) __ksym; extern int bpf_modify_return_test(int a, int *b) __ksym; extern const void bpf_fentry_test2 __ksym; extern const v...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_private_stack_fail' 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 "../test_kmods/bpf_testmod.h" char _license[] SEC("license") = "GPL"; void bpf_testmod_ops3_call_test_2(void) __ksym; int val_i, val_j; __noinline static int subprog2(int *a, int *b) { ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_pkt_md_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/pkt_cls.h> #include <bpf/bpf_helpers.h> #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #define TEST_FIELD(TYPE, FIELD, MASK) \ { \ TYPE tmp = *(v...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_setsockopt' 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_tracing_net.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #define bpf_tcp_sk(skc) ({ \ struct sock_common *_skc = skc; \ sk = NULL; \ tp = NULL; \ if (_skc) { \ tp = bpf_sk...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_assoc_in_timer' 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"; struct elem { struct bpf_timer timer; }; struct { __uint(type, BPF_MAP_TYPE_A...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_subprogs_unused' alt sistemi için gerekli C kaynak kodunu implemente et.
```c #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> const char LICENSE[] SEC("license") = "GPL"; __attribute__((unused)) __noinline int unused1(int x) { return x + 1; } static __attribute__((unused)) __noinline int unused2(int x) { return x + 2; } SEC("raw_tp/sys_enter") int main...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_kptr_return_fail__invalid_scalar' 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"; struct cgroup *bpf_cgroup_acquire(struct cgroup *p) __ksym; void bpf_task_release(struct task_struct *p) __ksym; /* This test struct_ops BPF programs returning r...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/raw_tp_null_fail' 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" char _license[] SEC("license") = "GPL"; /* Ensure module parameter has PTR_MAYBE_NULL */ SEC("tp_btf/bpf_testmod_test_raw_tp_null_tp") __failu...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_stacktrace_build_id' 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> #ifndef PERF_MAX_STACK_DEPTH #define PERF_MAX_STACK_DEPTH 127 #endif struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 1); __type(key, __u32); __type(value, __u32); } c...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/xdp_synproxy_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: LGPL-2.1 OR BSD-2-Clause /* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ #define BPF_NO_KFUNC_PROTOTYPES #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #include <asm/errno.h> #include "bpf_compiler.h" #define TC_ACT_OK 0...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bloom_filter_map' 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> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; struct bpf_map; struct { __uint(type, BPF_MAP_TYPE_ARRAY); __type(key, __u32); __type(value, __u32); __uint(max_entries, 10...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_bpf_nf' 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_helpers.h> #include <bpf/bpf_endian.h> #define EAFNOSUPPORT 97 #define EPROTO 71 #define ENONET 64 #define EINVAL 22 #define ENOENT 2 #define NF_CT_ZONE_DIR_ORIG (1 << IP_CT_DIR_ORIGINAL) #define NF_CT_ZONE...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/summarization' 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" __noinline long changes_pkt_data(struct __sk_buff *sk) { return bpf_skb_pull_data(sk, 0); } __noinline __weak long does_not_change_pkt_data(struct __sk_buff *sk) { return 0; } SEC("?tc") int main_chang...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_d_path_check_rdonly_mem' 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> extern const int bpf_prog_active __ksym; SEC("fentry/security_inode_getattr") int BPF_PROG(d_path_check_rdonly_mem, struct path *path, struct kstat *stat, __u3...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/set_global_vars' 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 "bpf_experimental.h" #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #include <stdbool.h> char _license[] SEC("license") = "GPL"; typedef __s32 s32; typedef s32 i32; typedef __u8 u8; enum Enum { EA1 = 0...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/irq' 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_misc.h" #include "bpf_experimental.h" unsigned long global_flags; extern void bpf_local_irq_save(unsigned long *) __weak __ksym; extern void bpf_local_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_sockmap_progs_query' 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, 1); __type(key, __u32); __type(value, __u64); } sock_map SEC(".maps"); SEC("sk_skb") int prog_skb_verdict(struct __sk_buff *skb) { return SK_PASS; } SEC("sk...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/timer_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 <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;...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tcp_rtt' 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 tcp_rtt_storage { __u32 invoked; __u32 dsack_dups; __u32 delivered; __u32 delivered_ce; __u32 icsk_retransmits; __u32 mrtt_us; /* args[0] */ __u32 srtt; /* args[1] */ }; ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_test_kern3' 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"; SEC("iter/task") int dump_task(struct bpf_iter__task *ctx) { struct seq_file *seq = ctx->meta->seq; struct task_struct *task = ctx->task; int tgid; ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/task_ls_uptr' 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 task_struct *bpf_task_from_pid(s32 pid) __ksym; void bpf_task_release(struct task_struct *p) __ksym; void bpf_cgroup_release(str...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/preempted_bpf_ma_op' 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_experimental.h" struct bin_data { char data[256]; struct bpf_spin_lock lock; }; struct map_value { struct bin_data __kptr * d...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/for_each_multi_maps' 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 { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 3); __type(key, __u32); __type(value, __u64); } arraymap SEC(".maps"); struct { __uint(type, BPF_MAP_TYPE_HASH); __ui...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/xdp_metadata2' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include "xdp_metadata.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> extern int bpf_xdp_metadata_rx_hash(const struct xdp_md *ctx, __u32 *hash, enum xdp_rss_hash_type *rss_type) __ksym; int called; SEC("freplace/rx") int freplace_rx...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_core_reloc_enumval' 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 = {}; enum named_enum...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tailcall6' 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, 1); __uint(key_size, sizeof(__u32)); __uint(value_size, sizeof(__u32)); } jmp_table SEC(".maps"); int count, which; SEC("tc") int classifier_0(struct _...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_verif_scale2' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Facebook #include "vmlinux.h" #include <bpf/bpf_helpers.h> #define ATTR __always_inline #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)ctx->data; v...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/xdp_flowtable' 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_helpers.h> #include <bpf/bpf_endian.h> #define ETH_P_IP 0x0800 #define ETH_P_IPV6 0x86dd #define IP_MF 0x2000 /* "More Fragments" */ #define IP_OFFSET 0x1fff /* "Fragment Offset" */ #define AF_INET 2 #defi...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_autoattach' 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_tracing.h> bool prog1_called = false; bool prog2_called = false; SEC("raw_tp/sys_enter") int prog1(const void *ctx) { prog1_called = true; return 0; } SEC("raw_tp/sys_exit") int prog2(const void *ctx) {...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/rbtree_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_experimental.h" #include "bpf_misc.h" struct node_data { long key; long data; struct bpf_rb_node node; }; #define private(name) SEC(".data." #name) __...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_subskeleton_lib' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) Meta Platforms, Inc. and affiliates. */ #include <stdbool.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> /* volatile to force a read */ const volatile int var1; volatile int var2 = 1; struct { int var3_1; __s64 var3_2; } var3; int libout1; extern vo...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/update_map_in_htab' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2024. Huawei Technologies Co., Ltd */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> struct inner_map_type { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(key_size, 4); __uint(value_size, 4); __uint(max_entries, 1); } inner_map SEC(".maps"); struct { __ui...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_core_reloc_flavors' 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_flavors { int a; int b; int...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/nested_trust_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 "nested_trust_common.h" char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_SK_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/compute_live_registers' 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 "../../../include/linux/filter.h" #include "bpf_arena_common.h" #include "bpf_misc.h" struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 1); __type(key, __u32); __type(value, __u64); } test_map SEC("....
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_vma_offset' 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> char _license[] SEC("license") = "GPL"; __u32 unique_tgid_cnt = 0; uintptr_t address = 0; uintptr_t offset = 0; __u32 last_tgid = 0; __u32 pid = 0; __u32 page_shift ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_gotox' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2025 Isovalent */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #include "../../../include/linux/filter.h" #if defined(__TARGET_ARCH_x86) || defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_powerpc) #define DEFINE_SIMPLE_JUMP_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_map_ptr_mixing' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/map_ptr_mixing.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_AR...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_probe_read_user_str' 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 <sys/types.h> pid_t pid = 0; long ret = 0; void *user_ptr = 0; char buf[256] = {}; SEC("tracepoint/syscalls/sys_enter_nanosleep") int on_write(void *ctx) { if (pid != (bpf_get_current_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_sk_assign' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Cloudflare Ltd. // Copyright (c) 2020 Isovalent, Inc. #include <stddef.h> #include <stdbool.h> #include <string.h> #include <linux/bpf.h> #include <linux/if_ether.h> #include <linux/in.h> #include <linux/ip.h> #include <linux/ipv6.h> #include <linux/pkt_cl...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/core_reloc_types' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c #include <stdint.h> #include <stdbool.h> void preserce_ptr_sz_fn(long x) {} #define __bpf_aligned __attribute__((aligned(8))) /* * KERNEL */ struct core_reloc_kernel_output { int valid[10]; char comm[sizeof("test_progs")]; int comm_len; bool local_task_struct_matches; }; /* * MODULE */ struct core_re...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_sk_lookup' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause // Copyright (c) 2020 Cloudflare #include <errno.h> #include <stdbool.h> #include <stddef.h> #include <linux/bpf.h> #include <linux/in.h> #include <sys/socket.h> #include <bpf/bpf_endian.h> #include <bpf/bpf_helpers.h> #define IP4(a, b, c, d) \ bpf_htonl(...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_linked_scalars' 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" SEC("socket") __description("scalars: find linked scalars") __failure __msg("math between fp pointer and 2147483647 is not allowed") __naked void scalars(void) { asm volatile (" \...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_bpf_link' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022 Red Hat, Inc. */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; SEC("iter/bpf_link") int dump_bpf_link(struct bpf_iter__bpf_link *ctx) { struct seq_file *seq = ctx->meta->seq; struct bpf_link *link = ctx->link;...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_store_release' 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("store-release, 8-bit") __success __success_unpriv __retval(...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_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> #define IFINDEX_LO 1 struct { __uint(type, BPF_MAP_TYPE_CPUMAP); __uint(key_size, sizeof(__u32)); __uint(value_size, sizeof(struct bpf_cpumap_val)); __uint(max_entries, 4); } cpu_map SEC(".maps"); __u32 redirect_count =...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_task_btf' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020, Oracle and/or its affiliates. */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> #include <errno.h> char _license[] SEC("license") = "GPL"; long tasks = 0; long seq_err = 0; bool skip = false; SEC("iter/task") int dump_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cgroup_mprog' 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("cgroup/getsockopt") int getsockopt_1(struct bpf_sockopt *ctx) { return 1; } SEC("cgroup/getsockopt") int getsockopt_2(...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_autocreate' 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> char _license[] SEC("license") = "GPL"; int test_1_result = 0; SEC("struct_ops/test_1") int BPF_PROG(test_1) { test_1_result = 42; return 0; } SEC("struct_ops/test_1") int BPF_PROG(test_2) { ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/sockopt_multi' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <netinet/in.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; __s32 page_size = 0; SEC("cgroup/getsockopt") int _getsockopt_child(struct bpf_sockopt *ctx) { __u8 *optval_end = ctx->optval_end; __u8 *optval = ctx->optval;...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/mptcpify' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023, SUSE. */ #include "vmlinux.h" #include <bpf/bpf_tracing.h> #include "bpf_tracing_net.h" char _license[] SEC("license") = "GPL"; int pid; SEC("fmod_ret/update_socket_protocol") int BPF_PROG(mptcpify, int family, int type, int protocol) { if (bpf_get_cur...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/arena_spin_lock' 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_misc.h" #include "bpf_arena_spin_lock.h" struct { __uint(type, BPF_MAP_TYPE_ARENA); __uint(map_flags, BPF_F_MMAPABLE); _...