instruction
stringlengths
82
202
input
stringclasses
1 value
output
stringlengths
73
23.9M
Linux kernel'inin 'tools/testing/selftests/bpf/progs/pyperf_subprogs' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #define STACK_MAX_LEN 50 #define SUBPROGS #include "pyperf.h" ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/refcounted_kptr_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_acquire { long key; long data; struct bpf_rb_node node; struct bpf_refcount refcount; }; extern voi...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_bpf_array_map' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 3); __type(key, __u32); __type(value, __u64); } arraymap1...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_tracepoint' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2017 Facebook #include <vmlinux.h> #include <bpf/bpf_helpers.h> /* taken from /sys/kernel/tracing/events/sched/sched_switch/format */ struct sched_switch_args { unsigned long long pad; char prev_comm[TASK_COMM_LEN]; int prev_pid; int prev_prio; long long ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_enable_stats' 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 <linux/types.h> #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; __u64 count = 0; SEC("raw_tracepoint/sys_enter") int test_enable_stats(void *ctx) { __sync_fetch_and_add(&...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_core_reloc_kernel' 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 <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; uint64_t my_pid_tgid; } data...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/map_in_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 kernel'inin 'tools/testing/selftests/bpf/progs/bad_struct_ops' 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"; SEC("struct_ops/test_1") int BPF_PROG(test_1) { return 0; } SEC("struct_ops/test_2") int BPF_PROG(test_2) { return 0;...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/socket_cookie_prog' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2018 Facebook #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #include <bpf/bpf_tracing.h> #define AF_INET6 10 struct socket_cookie { __u64 cookie_key; __u32 cookie_value; }; struct { __uint(type, BPF_MAP_TYPE_SK_STORAGE); ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_skmsg_load_helpers' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2020 Isovalent, Inc. #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"); struct { __uint(type, BPF_MAP_TYPE_SOCKHASH); _...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_tcpnotify_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <stddef.h> #include <string.h> #include <netinet/in.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/types.h> #include <linux/socket.h> #include <linux/tcp.h> #include <bpf/b...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/jit_probe_mem' 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 "../test_kmods/bpf_testmod_kfunc.h" static struct prog_test_ref_kfunc __kptr *v; long total_sum = -1; SEC("tc") int test_jit_pr...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/getpeername4_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_IP4 0xc0a801fe // 192.168.1.254 #define REWRITE_ADDRESS_PORT4...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cgrp_ls_attach_cgroup' 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_tracing_net.h" char _license[] SEC("license") = "GPL"; struct socket_cookie { __u64 cookie_key; __u64 cookie_value; }; ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_map_ptr' 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.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_ARRAY); ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_tc_neigh' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <stddef.h> #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/in.h> #include <linux/ip.h> #include <linux/ipv6.h> #include <bpf/bpf_helpers.h> #include <bpf/b...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/loop6' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include <bpf/bpf_core_read.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; /* typically virtio scsi has max SGs of 6 */ #define VIRTIO_MAX_SGS 6 /* Verifier will fail with SG_MAX...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_helper_packet_access' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/helper_packet_access.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); } ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_xdp' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Copyright (c) 2016,2017 Facebook * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. */ #include <stddef.h> #include <string.h> #include <linux/bpf.h> #include <linux/if_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_xdp_with_devmap_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"); SEC("xdp") int xdp_redir_prog(struct xdp_md ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/setget_sockopt' 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 "vmlinux.h" #include "bpf_tracing_net.h" #include <bpf/bpf_core_read.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" extern unsigned long CONFIG_HZ __kconfig; const volatile c...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/for_each_hash_map_elem' 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 { __uint(type, BPF_MAP_TYPE_HASH); __uint(max_entries, 3); __type(key, __u32); __type(value, __u64); } hashmap SEC(".maps"); struct { __uint...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_direct_stack_access_wraparound' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/direct_stack_access_wraparound.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" SEC("socket") __description("direct stack access with 32-bit wraparound. test1") __failure __msg("fp pointer and...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_global_func13' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" struct S { int x; }; __noinline int foo(const struct S *s) { if (s) return bpf_get_prandom_u32() < s->x; return 0; } SEC("cgroup_skb/ingress") __failure __msg("Caller pass...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/atomic_bounds' 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> #ifdef ENABLE_ATOMICS_TESTS bool skip_tests __attribute((__section__(".data"))) = false; #else bool skip_tests = true; #endif SEC("fentry/bpf_fentry_test1") int BPF_PROG(sub, ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_core_reloc_bitfields_probed' 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_bitfields { /* unsigned bitfi...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_tasks' 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> char _license[] SEC("license") = "GPL"; uint32_t tid = 0; int num_unknown_tid = 0; int num_known_tid = 0; void *user_ptr = 0; void *user_ptr_long = 0; uint32_t pid ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_uninit' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/uninit.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "../../../include/linux/filter.h" #include "bpf_misc.h" SEC("socket") __description("read uninitialized register") __failure __msg("R2 !read_ok") __f...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/bpf_compiler' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ #ifndef __BPF_COMPILER_H__ #define __BPF_COMPILER_H__ #define DO_PRAGMA_(X) _Pragma(#X) #if __clang__ #define __pragma_loop_unroll DO_PRAGMA_(clang loop unroll(enable)) #else /* In GCC -funroll-loops, which is enabled with -O2, should have the same impact than the loop-u...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_sysctl_loop2' 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/btf__core_reloc_nesting___dup_compat_types' alt sistemi için gerekli C kaynak kodunu implemente et.
```c #include "core_reloc_types.h" void f1(struct core_reloc_nesting___dup_compat_types x) {} void f2(struct core_reloc_nesting___dup_compat_types__2 x) {} void f3(struct core_reloc_nesting___dup_compat_types__3 x) {} ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/read_cgroupfs_xattr' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2025 Meta Platforms, Inc. and affiliates. */ #include <vmlinux.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> #include "bpf_experimental.h" char _license[] SEC("license") = "GPL"; pid_t target_pid = 0; char xattr_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_static_linked1' 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> /* 8-byte aligned .data */ static volatile long static_var1 = 2; static volatile int static_var2 = 3; int var1 = -1; /* 4-byte aligned .rodata */ const volatile int rovar1; /* same "subprog"...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_live_stack' 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 "../../../include/linux/filter.h" #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_HASH); __uint(max_ent...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_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> #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"); SEC("xdp/cpumap") int ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_task_under_cgroup' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Bytedance */ #include <vmlinux.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" struct cgroup *bpf_cgroup_from_id(u64 cgid) __ksym; long bpf_task_under_cgroup(struct task_struct *task, struct cgroup *ancestor) __ksym; vo...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_task_stack' 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"; #define MAX_STACK_TRACE_DEPTH 64 unsigned long entries[MAX_STACK_TRACE_DEPTH] = {}; #define SIZE_OF_ULONG (sizeof(unsigned long)) SEC("iter/task") int...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_map_in_map' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2018 Facebook */ #include <stddef.h> #include <linux/bpf.h> #include <linux/types.h> #include <bpf/bpf_helpers.h> struct { __uint(type, BPF_MAP_TYPE_ARRAY_OF_MAPS); __uint(max_entries, 1); __uint(map_flags, 0); __type(key, __u32); __type(value, __u32); } m...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/xdp_features' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <stdbool.h> #include <linux/bpf.h> #include <linux/netdev.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #include <bpf/bpf_tracing.h> #include <linux/if_ether.h> #include <linux/ip.h> #include <linux/ipv6.h> #include <linux/in.h> #include <linux/in6.h> #in...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_loops1' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/loops1.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" SEC("xdp") __description("bounded loop, count to 4") __success __retval(4) __naked void bounded_loop_count_to_4(void) { asm volatile ("...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/iters_testmod_seq' 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_misc.h" struct bpf_iter_testmod_seq { u64 :64; u64 :64; }; extern int bpf_iter_testmod_seq_new(struct bpf_iter_testmod_seq *it, s64 value, int cnt) ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_snprintf' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Google LLC. */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> __u32 pid = 0; char num_out[64] = {}; long num_ret = 0; char ip_out[64] = {}; long ip_ret = 0; char sym_out[64] = {}; long sym_ret = 0; char addr_out[64] = {}; long addr_ret = 0; char...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_xdp_attach_fail' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright Leon Hwang */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #define ERRMSG_LEN 64 struct xdp_errmsg { char msg[ERRMSG_LEN]; }; struct { __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY); __type(key, int); __type(value, int); } xdp_errmsg_pb SEC(".maps"); st...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_unix' 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_tracing_net.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> char _license[] SEC("license") = "GPL"; SEC(".maps") struct { __uint(type, BPF_MAP_TYPE_SOCKMAP); __uint(max_entries,...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_ringbuf_map_key' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022 Meta Platforms, Inc. and affiliates. */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; struct sample { int pid; int seq; long value; char comm[16]; }; struct { __uint(type, BPF_MAP_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/netif_receive_skb' 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 "btf_ptr.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_core_read.h> #include "bpf_misc.h" #include <errno.h> long ret = 0; int num_subtests = 0; int ran_subtests = 0; bool skip =...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_custom_sec_handlers' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022 Facebook */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> const volatile int my_pid; bool abc1_called; bool abc2_called; bool custom1_called; bool custom2_called; bool kprobe1_called; bool xyz_called; SEC("abc") int abc1...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_div_mod_bounds' 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" /* This file contains unit tests for signed/unsigned division and modulo * operations (with divisor as a constant), focusing on verifying whether * BPF verifier's range tracking mod...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_kfunc_param_nullable' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 Meta Platforms, Inc */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #include "bpf_kfuncs.h" #include "../test_kmods/bpf_testmod_kfunc.h" SEC("tc") int kfunc_dynptr_nullable_test1(struct __sk_buff *skb) { struct bpf_dynptr data; ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/task_ls_recursion' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #ifndef EBUSY #define EBUSY 16 #endif char _license[] SEC("license") = "GPL"; int nr_del_errs = 0; int test_pid = 0; struct { __uint(type, BPF_MAP_TYPE_TASK_STOR...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bad_struct_ops2' 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"; /* This is an unused struct_ops program, it lacks corresponding * struct_ops map, which provides attachment information. * W/o additional configuration attempt to load such * BPF ob...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/exceptions_ext' 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_experimental.h" SEC("?fentry") int pfentry(void *ctx) { return 0; } SEC("?fentry") int throwing_fentry(void *ctx) { bpf_throw(0); return 0; } __noinline int exception_cb(u64 cookie) { return cookie + 64; } S...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_prog_array_init' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* SPDX-License-Identifier: GPL-2.0 */ /* Copyright (c) 2021 Hengqi Chen */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> const volatile pid_t my_pid = 0; int value = 0; SEC("raw_tp/sys_enter") int tailcall_1(void *ctx) { value = 42; return 0; } struct { __uint(type, BPF_MAP...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_core_reloc_nesting' 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_nesting_substruct { int a; };...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_core_reloc_misc' 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_misc_output { int a, b, c; };...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_sockmap_mutate' 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 "bpf_misc.h" #define __always_unused __attribute__((unused)) char _license[] SEC("license") = "GPL"; struct sock { } __attribute__((preserve_access_index)); struct bpf_iter__sockmap {...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_sysctl_prog' 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" /* Max supported length of a string with unsigned long in base 10 (pow2 - 1)....
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_xdp_context_test_run' 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("xdp") int xdp_context(struct xdp_md *xdp) { void *data = (void *)(long)xdp->data; __u32 *metadata = (void *)(long)xdp->data_meta; __u32 ret; if (metadata + 1 > data) return XDP_ABORTED; ret = *metadata; if (bpf_x...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_lookup_key' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2022 Huawei Technologies Duesseldorf GmbH * * Author: Roberto Sassu <roberto.sassu@huawei.com> */ #include "vmlinux.h" #include <errno.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; __u32 monitored_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/nested_acquire' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #include "../test_kmods/bpf_testmod_kfunc.h" char _license[] SEC("license") = "GPL"; SEC("tp_btf/tcp_probe") __success int BPF_PROG(test_nested_acquire_nonzero, struct sock *s...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/priv_prog' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; SEC("xdp") int xdp_prog1(struct xdp_md *xdp) { return XDP_DROP; } ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/get_branch_snapshot' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; __u64 test1_hits = 0; __u64 address_low = 0; __u64 address_high = 0; int wasted_entries = 0; long total_entries = 0; #defin...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tailcall1' 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"); #define TAIL_FUNC(x) \ SEC("tc") \ int classi...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tailcall_bpf2bpf1' 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"); #define TAIL_FUNC(x) \ SEC("tc") \ int classif...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/local_kptr_stash' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */ #include <vmlinux.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> #include "../bpf_experimental.h" #include "../test_kmods/bpf_testmod_kfunc.h" struct plain_local; struct...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_lwt' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/lwt.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" SEC("lwt_in") __description("invalid direct packet write for LWT_IN") __failure __msg("cannot write into packet") __naked void packet_write...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_ringbuf' 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> #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; struct sample { int pid; int seq; long value; char comm[16]; }; struct { __uint(type, BPF_MAP_TYPE_RINGBUF); } ringbuf SEC("....
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_xdp_adjust_tail_grow' 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("xdp") int _xdp_adjust_tail_grow(struct xdp_md *xdp) { int data_len = bpf_xdp_get_buff_len(xdp); int offset = 0; /* SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) */ #if defined(__TARGET_ARCH_s390) int tailroom = 512; ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/trigger_bench' 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 <asm/unistd.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "bpf/usdt.bpf.h" char _license[] SEC("license") = "GPL"; #define CPU_MASK 255 #define MAX_CPUS (CPU_MASK + 1) /*...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cgrp_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 "cgrp_kfunc_common.h" char _license[] SEC("license") = "GPL"; int err, pid, invocations; /* Prototype for all of the program...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_tcpbpf_kern' 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_helpers.h> #include <bpf/bpf_endian.h> #include "test_tcpbpf.h" struct tcpbpf_globals global = {}; /** * SOL_TCP is defined in <netinet/tcp.h> while * TCP_SAVED_SYN is defined in already included <linux/tcp.h> */ #ifndef SOL_TC...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_qdisc_fifo' 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"; struct skb_node { struct sk_buff __kptr * skb; struct bpf_list_node node; }; private(A) struct bpf_spin_lock q_fifo_lock; private(A) struct bpf_list_hea...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_global_func15' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" __noinline int foo(unsigned int *v) { if (v) *v = bpf_get_prandom_u32(); return 0; } SEC("cgroup_skb/ingress") __failure __msg("At program exit the register R0 has ") int gl...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_may_goto_2' 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_misc.h" #include "bpf_experimental.h" int gvar; SEC("raw_tp") __description("C code with may_goto 0") __success int may_goto_c_code(void) { int i, tmp[3]; for (i = 0; i < 3 && can_loop; i++) tmp[...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_xdp_meta' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include <bpf/bpf_endian.h> #include <bpf/bpf_helpers.h> #include <errno.h> #include "bpf_kfuncs.h" #include "bpf_tracing_net.h" #define META_SIZE 32 #define ctx_ptr(ctx, mem) (void *)(unsigned long)ctx->mem /* Demonstrate passing metadata from XDP to T...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_get_xattr' 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 <errno.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_kfuncs.h" #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; __u32 monitored_pid; __u32 fou...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/map_kptr_fail' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> #include "bpf_misc.h" #include "../test_kmods/bpf_testmod_kfunc.h" struct map_value { char buf[8]; struct prog_test_ref_kfunc __kptr_untrusted *unref_ptr; struct pro...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/csum_diff_test' 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 <linux/types.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #define BUFF_SZ 512 /* Will be updated by benchmark before program loading */ char to_buff[BUFF_SZ]; const volatile unsig...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_module' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "../test_kmods/bpf_testmod.h" char _license[] SEC("license") = "GPL"; int test_1_result = 0; int test_2_result = 0; SEC("struc...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_xdp_vlan' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* SPDX-License-Identifier: GPL-2.0 * Copyright(c) 2018 Jesper Dangaard Brouer. * * XDP/TC VLAN manipulation example * * GOTCHA: Remember to disable NIC hardware offloading of VLANs, * else the VLAN tags are NOT inlined in the packet payload: * * # ethtool -K ixgbe2 rxvlan off * * Verify setting: * #...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_leak_ptr' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/leak_ptr.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" struct { __uint(type, BPF_MAP_TYPE_HASH); __uint(max_entries, 1); __type(key, long long); __type(value, long long); } map_hash_8b ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/string_kfuncs_failure1' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2025 Red Hat, Inc.*/ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <linux/limits.h> #include "bpf_misc.h" #include "errno.h" char *user_ptr = (char *)1; char *invalid_kern_ptr = (char *)-1; /* * When passing userspace pointers, the error code dif...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/linked_funcs1' 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 two files */ const volatile __u32 my_tid __weak; long syscall_id __weak; int output...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_ldsx_insn' 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> #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/getsockname4_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_IP4 0xc0a801fe // 192.168.1.254 #define REWRITE_ADDRESS_PORT4...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/strobemeta' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) // Copyright (c) 2019 Facebook #define STROBE_MAX_INTS 2 #define STROBE_MAX_STRS 25 #define STROBE_MAX_MAPS 100 #define STROBE_MAX_MAP_ENTRIES 20 /* full unroll by llvm #undef NO_UNROLL */ #include "strobemeta.h" ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_value' 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.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); __u...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/twfw' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include <linux/types.h> #include <bpf/bpf_helpers.h> #include <linux/bpf.h> #include <stdint.h> #define TWFW_MAX_TIERS (64) /* * load is successful * #define TWFW_MAX_TIERS (64u)$ */ struct twfw_tier_value { unsigned long mask[1]; }; str...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cgroup_getset_retval_getsockopt' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * Copyright 2021 Google LLC. */ #include <errno.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> __u32 invocations = 0; __u32 assertion_error = 0; __u32 retval_value = 0; __u32 ctx_retval_value = 0; __u32 page_size = 0; SEC("cgroup/getsockopt") int get_retval...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/uprobe_syscall_executed' 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/usdt.bpf.h> #include <string.h> struct pt_regs regs; char _license[] SEC("license") = "GPL"; int executed = 0; int pid; SEC("uprobe") int BPF_UPROBE(test_uprobe) { if (bpf_get_curre...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/connect6_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 <sys/socket.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #define SRC_REWRITE_IP6_0 0 #define SRC_REWRITE_I...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_global_func16' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" __noinline int foo(int (*arr)[10]) { if (arr) return (*arr)[9]; return 0; } SEC("cgroup_skb/ingress") __success int global_func16(struct __sk_buff *skb) { int array[10]; ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/kfree_skb' 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 <stdbool.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY); __type(key, int); __...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_bpf_percpu_array_map' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); __uint(max_entries, 3); __type(key, __u32); __type(value, __u32); } ar...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/btf_type_tag' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #if __has_attribute(btf_type_tag) #define __tag1 __attribute__((btf_type_tag("tag1"))) #define __tag2 __attribute__((btf_type_tag("tag2"))) volatile const bool skip_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_bpf_sk_storage_helpers' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Google LLC. */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_SK_STORAGE); __uint(map_flags, BPF_F_NO_PREALLOC); __type(key, int); __type(value,...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/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 "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> __u32 target_id; __s64 bpf_map_sum_elem_count(const struct bpf_map *map) __ksym; SEC("iter/bpf_map") int dump_bpf_map(struct bpf_iter__bpf_map *ctx) { struct se...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_map_in_map' 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_in_map.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" struct { __uint(type, BPF_MAP_TYPE_ARRAY_OF_MAPS); __uint(max_entries, 1); __type(key, int); __type(value, int); __array(values...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_bpf_hash_map' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; struct key_t { int a; int b; int c; }; struct { __uint(type, BPF_MAP_TYPE_HASH); __uint(max_entries, 3); __type(key, struct key_t); __type(value,...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_subreg' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/subreg.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" /* This file contains sub-register zero extension checks for insns defining * sub-registers, meaning: * - All insns under BPF_ALU cl...