instruction
stringlengths
82
202
input
stringclasses
1 value
output
stringlengths
73
23.9M
Linux kernel'inin 'tools/testing/selftests/bpf/progs/timer' 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 <stdbool.h> #include <errno.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #define CLOCK_MONOTONIC 1 #define CLOCK_BOOTTIME 7 char _license[] SEC("license") = "GPL"; struct hmap_elem { int counter...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/linked_list' 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" #include "linked_list.h" struct head_nested_inner { struct bpf_spin_lock lock; struct bpf_list_head head __contai...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_map_lookup_percpu_elem' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022 Bytedance */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> __u64 percpu_array_elem_sum = 0; __u64 percpu_hash_elem_sum = 0; __u64 percpu_lru_hash_elem_sum = 0; const volatile int nr_cpus; const volatile int my_pid; struct { __uint(type, BPF_MAP_TYPE...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_xdp_adjust_tail_shrink' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2018 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 <linux/bpf.h> #include <linux/if_ether.h> ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/freplace_get_constant' 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> volatile __u64 test_get_constant = 0; SEC("freplace/get_constant") int security_new_get_constant(long val) { if (val != 123) return 0; test_get_constant = 1; return test_get_constant; /* origin...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cgrp_kfunc_failure' 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_misc.h" #include "cgrp_kfunc_common.h" char _license[] SEC("license") = "GPL"; /* Prototype for all of the program trace...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/perfbuf_bench' 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 <bpf/bpf_helpers.h> #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY); __uint(value_size, sizeof(int)); __uint(key_size, size...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_refcounted_fail__tail_call' 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 "../test_kmods/bpf_testmod.h" #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_PROG_ARRAY); __uint(max_ent...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/task_work_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_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; const void *user_ptr = NULL; st...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cgroup_skb_sk_lookup_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2020 Facebook #include <linux/bpf.h> #include <bpf/bpf_endian.h> #include <bpf/bpf_helpers.h> #include <linux/if_ether.h> #include <linux/in.h> #include <linux/in6.h> #include <linux/ipv6.h> #include <linux/tcp.h> #include <sys/types.h> #include <sys/socket.h...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tcp_ca_update' 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_tracing.h> char _license[] SEC("license") = "GPL"; int ca1_cnt = 0; int ca2_cnt = 0; SEC("struct_ops") void BPF_PROG(ca_update_1_init, struct sock *sk) { ca1_cnt++; } SEC("struct_ops") void BPF_PRO...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_const' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 Isovalent */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" const volatile long foo = 42; long bar; long bart = 96; SEC("tc/ingress") __description("rodata/strtol: write rejected") __failure __msg("wr...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_uprobe_autoattach' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022, Oracle and/or its affiliates. */ #include "vmlinux.h" #include <bpf/bpf_core_read.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" int uprobe_byname_parm1 = 0; int uprobe_byname_ran = 0; int uretprobe_byname_rc = 0; int...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_tp_btf_nullable' 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" #include "bpf_misc.h" SEC("tp_btf/bpf_testmod_test_nullable_bare_tp") __failure __msg("R1 invalid mem access 'trusted_ptr_or_null_'") int BPF_PROG(handle_tp_bt...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_multi_pages' 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"; #define TRAMP(x) \ SEC("struct_ops/tramp_" #x) \ int B...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_global_func10' 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" #if !defined(__clang__) #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif struct Small { long x; }; struct Big { long x; long y; }; __noinline int foo(const stru...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/bpf_test_utils' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ #ifndef __BPF_TEST_UTILS_H__ #define __BPF_TEST_UTILS_H__ #include <bpf/bpf_helpers.h> #include "bpf_misc.h" /* Clobber as many native registers and stack slots as possible. */ static __always_inline void clobber_regs_stack(void) { char tmp_str[] = "123456789"; unsigned l...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/htab_update' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2022. Huawei Technologies Co., Ltd */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; /* Map value type: has BTF-managed field (bpf_timer) */ struct val { struct bpf_timer t; __u64 payl...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/iters_task_vma' 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_experimental.h" #include <bpf/bpf_helpers.h> #include "bpf_misc.h" pid_t target_pid = 0; unsigned int vmas_seen = 0; struct { __u64 vm_start; __u64 vm_end; } vm_ranges[1000]; S...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/trace_vprintk' 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_misc.h" char _license[] SEC("license") = "GPL"; int null_data_vprintk_ret = 0; int trace_vprintk_ret = 0; int trace_vprintk_ran = 0; SEC("fentry/" S...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_arena_globals2' 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. */ #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_PAGES (3...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_tc_tunnel' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* In-place tunneling */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #include "bpf_tracing_net.h" #include "bpf_compiler.h" #pragma GCC diagnostic ignored "-Waddress-of-packed-member" static const int cfg_port = 8000; static const int cfg_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/btf_data' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) struct S { int a; int b; int c; }; union U { int a; int b; int c; }; struct S1 { int a; int b; int c; }; union U1 { int a; int b; int c; }; typedef int T; typedef int S; typedef int U; typedef int T1; typedef int S1; typedef int U1; struct ro...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_sk_storage_trace_itself' 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_tracing.h> #include <bpf/bpf_helpers.h> struct { __uint(type, BPF_MAP_TYPE_SK_STORAGE); __uint(map_flags, BPF_F_NO_PREALLOC); __type(key, int); __type(value, int); } sk_stg_map SEC(".maps"); SEC("fen...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_dst_clear' 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_tracing_net.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #define UDP_TEST_PORT 7777 void *bpf_cast_to_kern_ctx(void *) __ksym; bool had_dst = false; bool dst_clear...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/htab_reuse' 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 <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; struct htab_val { struct bpf_spin_lock lock; unsigned int data; }; struct { __uint(type, BPF_MAP_TYPE_HASH); __uint(max_entri...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/profiler1' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #define UNROLL #define INLINE __always_inline #include "profiler.inc.h" ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/security_bpf_map' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #include "vmlinux.h" #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; #define EPERM 1 /* Operation not permitted */ /* From include/linux/mm.h. */ #define FMODE_WRITE 0x2 struct map; struct { __uint(type, BPF_MAP_TYPE_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/rcu_read_lock' 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" #include "bpf_misc.h" /* clang considers 'sum += 1' as usage but 'sum++' as non-usage. GCC * is more cons...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_global_func7' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2020 Facebook */ #include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" __attribute__ ((noinline)) void foo(struct __sk_buff *skb) { skb->tc_index = 0; } SEC("tc") __success int global_func7(struct __sk_buff *skb) {...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/sendmsg4_prog' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2018 Facebook #include <linux/stddef.h> #include <linux/bpf.h> #include <sys/socket.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #include <bpf_sockopt_helpers.h> #define SRC1_IP4 0xAC100001U /* 172.16.0.1 */ #define SRC2_IP4 0x00000000U #def...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/exceptions_assert' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include <limits.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> #include <bpf/bpf_endian.h> #include "bpf_misc.h" #include "bpf_experimental.h" #define check_assert(type, op, name, value) \ SEC("?tc") \...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/timer_start_deadlock' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2026 Meta Platforms, Inc. and affiliates. */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #define CLOCK_MONOTONIC 1 char _license[] SEC("license") = "GPL"; struct elem { struct bpf_timer timer; }; struct { __uint(type, BPF...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tailcall_poke' 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"; struct { __uint(type, BPF_MAP_TYPE_PROG_ARRAY); __uint(max_entries, 1); __uint(key_size, sizeof(__u32)); __uint(value_size, sizeof(__u32)); } jmp_table ...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/bind_prog' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ #ifndef __BIND_PROG_H__ #define __BIND_PROG_H__ #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #define load_byte(src, b, s) \ (((volatile __u8 *)&(src))[b] << 8 * b) #define load_word(src, w, s) \ (((volatile __u16 *)&(src))[w] << 16 * w) #elif __BYTE_ORDER__ == __ORDER_BIG...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/read_vsyscall' 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 "vmlinux.h" #include <linux/types.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" int target_pid = 0; void *user_ptr = 0; int read_ret[10]; char _license[] SEC("license") = "GPL"; /* * These are the kfunc...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_sig_in_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 "err.h" char _license[] SEC("license") = "GPL"; #ifndef SHA256_DIGEST_SIZE #define ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_sockmap_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); } src SEC(".maps"); struct { __uint(type, BPF_MAP_TYPE_SOCKMAP); __uint(max_e...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/kptr_xchg_inline' 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/types.h> #include <bpf/bpf_helpers.h> #include "bpf_experimental.h" #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; struct bin_data { char blob[32]; }; #define private(name) SEC(".bss." #na...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_global_func14' 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; __noinline int foo(const struct S *s) { if (s) return bpf_get_prandom_u32() < *(const int *) s; return 0; } SEC("cgroup_skb/ingress") __failure __msg("reference t...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_sockmap_drop_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> 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); __type(key, int); _...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/test_tcp_custom_syncookie' 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_TCP_SYNCOOKIE_H #define _TEST_TCP_SYNCOOKIE_H #define __packed __attribute__((__packed__)) #define __force #define swap(a, b) \ do { \ typeof(a) __tmp = (a); \ (a) = (b); \ (b) = __tmp; \ } w...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/uprobe_multi_session_cookie' 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> char _license[] SEC("license") = "GPL"; int pid = 0; __u64 test_uprobe_1_result = 0; __u64 test_uprobe_2_result = 0; __u64 test_uprobe_3_result = 0; static int check_cookie(st...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_test_kern5' 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 key_t { int a; int b; int c; }; struct { __uint(type, BPF_MAP_TYPE_HASH); __uint(max_entries, 3); __type(key, ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/ima' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Copyright 2020 Google LLC. */ #include "vmlinux.h" #include <errno.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> u32 monitored_pid = 0; struct { __uint(type, BPF_MAP_TYPE_RINGBUF); __uint(max_entries, 1 << 12); } ringbuf SEC(".maps"); char _license[]...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_assign_reuse' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Isovalent */ #include <stdbool.h> #include <linux/bpf.h> #include <linux/if_ether.h> #include <linux/in.h> #include <linux/ip.h> #include <linux/ipv6.h> #include <linux/tcp.h> #include <linux/udp.h> #include <bpf/bpf_endian.h> #include <bpf/bpf_helpers.h> #...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_tc_dtime' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2022 Meta #include <stddef.h> #include <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 <linux/tc...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/strncmp_bench' 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 <linux/types.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #define STRNCMP_STR_SZ 4096 /* Will be updated by benchmark before program loading */ const volatile unsigned int cm...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/loop2' 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/consume_skb") int while_true(volatile struct pt_regs* ctx) { int i = 0; while (true) { if (PT_REGS_RC(...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_netfilter_link_attach' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-or-later #include "vmlinux.h" #include <bpf/bpf_helpers.h> #define NF_ACCEPT 1 SEC("netfilter") int nf_link_attach_test(struct bpf_nf_ctx *ctx) { return NF_ACCEPT; } char _license[] SEC("license") = "GPL"; ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tailcall_freplace' 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 = 0; SEC("freplace") int entry_freplace(str...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/epilogue_tailcall' 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"; static __noinline ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_xadd' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/xadd.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 SEC(...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_global_func12' 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) { return bpf_get_prandom_u32() < s->x; } SEC("cgroup_skb/ingress") __failure __msg("invalid mem access 'mem_or_null'...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/profiler3' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #define barrier_var(var) /**/ #define UNROLL #define INLINE __noinline #include "profiler.inc.h" ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/btf_dump_test_case_bitfields' 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 bitfield. * * Copyright (c) 2019 Facebook */ #include <stdbool.h> /* ----- START-EXPECTED-OUTPUT ----- */ /* *struct bitfields_only_mixed_types { * int a: 3; * long b: 2; * _Bool c: 1; * enum { * A = 0, * B = 1, *...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_ksyms_btf_write_check' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Google */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> extern const int bpf_prog_active __ksym; /* int type global var. */ SEC("raw_tp/sys_enter") int handler1(const void *ctx) { int *active; __u32 cpu; cpu = bpf_get_smp_processor_id(); active...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/sock_ops_get_sk' 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" /* * Test the SOCK_OPS_GET_SK() and SOCK_OPS_GET_FIELD() macros in * sock_ops_convert_ctx_access() when dst_reg == src_reg. * * When dst_reg == src_reg, the macros borrow a temporary register to load ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/summarization_freplace' 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> SEC("?freplace") long changes_pkt_data(struct __sk_buff *sk) { return bpf_skb_pull_data(sk, 0); } SEC("?freplace") long does_not_change_pkt_data(struct __sk_buff *sk) { return 0; } SEC("?freplace") long might_sleep(struct p...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_core_retro' 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/bpf_core_read.h> struct task_struct { int tgid; } __attribute__((preserve_access_index)); struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 1); __type(key, int); ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_precision' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2023 SUSE LLC */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "../../../include/linux/filter.h" #include "bpf_misc.h" struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 1); __type(key, __u32); __type(value, __u64); } precision_ma...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/pyperf_global' 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 GLOBAL_FUNC #include "pyperf.h" ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/lsm_cgroup_nonvoid' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; SEC("lsm_cgroup/inet_csk_clone") int BPF_PROG(nonvoid_socket_clone, struct sock *newsk, const struct request_sock *req) { /* Can not return any errors from ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cgroup_tcp_skb' 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 <bpf/bpf_endian.h> #include <bpf/bpf_helpers.h> #include <linux/if_ether.h> #include <linux/in.h> #include <linux/in6.h> #include <linux/ipv6.h> #include <linux/tcp.h> #include <sys/t...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_libbpf_get_fd_by_id_opts' 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> /* From include/linux/mm.h. */ #define FMODE_WRITE 0x2 s...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/linked_list' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c // SPDX-License-Identifier: GPL-2.0 #ifndef LINKED_LIST_H #define LINKED_LIST_H #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include "bpf_experimental.h" struct bar { struct bpf_list_node node; int data; }; struct foo { struct bpf_list_node node; struct bpf_list_head head __contains(bar, node); struc...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_scalar_ids' 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" /* Check that precision marks propagate through scalar IDs. * Registers r{0,1,2} have the same scalar ID. * Range information is propagated for scalars sharing same ID. * Check that precision mark for...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/map_kptr' 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 "../test_kmods/bpf_testmod_kfunc.h" struct map_value { struct prog_test_ref_kfunc __kptr_untrusted *unref_ptr; struct prog_test_ref_kfunc __kptr *ref_ptr; }; struct array_map { __uint(ty...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_global_func4' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2020 Facebook */ #include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" __attribute__ ((noinline)) int f1(struct __sk_buff *skb) { return skb->len; } __attribute__ ((noinline)) int f2(int val, struct __sk_buff *skb)...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/linked_list_peek' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2025 Meta Platforms, Inc. and affiliates. */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #include "bpf_experimental.h" struct node_data { struct bpf_list_node l; int key; }; #define private(name) SEC(".data." #name) __hidden __at...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_int_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/int_ptr.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" SEC("socket") __description("arg pointer to long uninitialized") __success __naked void arg_ptr_to_long_uninitialized(void) { asm vola...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_mul' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2025 Nandakumar Edamana */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" /* Intended to test the abstract multiplication technique(s) used by * the verifier. Using assembly to avoid compiler optimization...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_mtu' 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("tc/ingress") __description("uninit/mtu: write rejected") __success __caps_unpriv(CAP_BPF|CAP_NET_ADMIN) __failure_unpriv __msg_unpriv("invalid read from stack") int tc_uninit_mtu(struct __sk_buff *ctx...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_misc_tcp_hdr_options' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include <stddef.h> #include <errno.h> #include <stdbool.h> #include <sys/types.h> #include <sys/socket.h> #include <linux/ipv6.h> #include <linux/tcp.h> #include <linux/socket.h> #include <linux/bpf.h> #include <linux/types.h> #include <bpf/bp...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_mmap' 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> char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(map_flags, BPF_F_MMAPABLE | BPF_F_RDONLY_PROG); __type(key, __u32); __type(valu...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_tc_neigh_fib' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <stdint.h> #include <stdbool.h> #include <stddef.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/verifier_div_overflow' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/div_overflow.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <limits.h> #include "bpf_misc.h" /* Just make sure that JITs used udiv/umod as otherwise we get * an exception from INT_MIN/-1 overflow simila...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/cgrp_kfunc_common' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ /* Copyright (c) 2022 Meta Platforms, Inc. and affiliates. */ #ifndef _CGRP_KFUNC_COMMON_H #define _CGRP_KFUNC_COMMON_H #include <errno.h> #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> struct __cgrps_kfunc_map_value { struct cgroup __kptr ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_snprintf_single' 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> /* The format string is filled from the userspace such that loading fails */ const char fmt[10]; SEC("raw_tp/sys_enter") int handler(const void *ctx) { unsigned long long arg = 42; bpf...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_pe_preserve_elems' 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/bpf_tracing.h> struct { __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY); __uint(max_entries, 1); __type(key, int); __type(value, int); } array_1 SEC(".maps"); struct { __uint(type...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cb_refs' 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 "../test_kmods/bpf_testmod_kfunc.h" struct map_value { struct prog_test_ref_kfunc __kptr *ptr; }; struct { __uint(type, BPF_MAP_TYPE_ARRAY); __type(key, int); __type(value, struct map_v...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_xdp_bpf2bpf' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; struct net_device { /* Structure does not need to contain all entries, * as "preserve_access_index" will use BTF to fix this... */ int ifindex; } __at...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_jeq_infer_not_null' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/jeq_infer_not_null.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" struct { __uint(type, BPF_MAP_TYPE_XSKMAP); __uint(max_entries, 1); __type(key, int); __type(value, int); } map_xskmap S...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_perf_skip' 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> uintptr_t ip; SEC("perf_event") int handler(struct bpf_perf_event_data *data) { /* Skip events that have the correct ip. */ return ip != PT_REGS_IP(&data->regs); } char _license[] SEC("license") ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_raw_tp_writable' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/raw_tp_writable.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_h...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/timer_mim_reject' 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 <time.h> #include <errno.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; struct hmap_elem { int pad; /* unused */ struct bpf_timer timer; }; struct inner_ma...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_vmlinux' 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/bpf_core_read.h> #define MY_TV_NSEC 1337 bool tp_called = false; bool raw_tp_called = false; bool tp_btf_called = false; bool...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_const_or' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/const_or.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" SEC("tracepoint") __description("constant register |= constant should keep constant type") __success __naked void constant_should_keep...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/string_kfuncs_success' 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 "bpf_misc.h" #include "errno.h" char str[] = "hello world"; #define __test(retval) SEC("syscall") __success __retval(retval) /* Functional tests */ __test(0) int test_strcmp_eq(vo...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/mptcp_subflow' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020, Tessares SA. */ /* Copyright (c) 2024, Kylin Software */ /* vmlinux.h, bpf_helpers.h and other 'define' */ #include "bpf_tracing_net.h" #include "mptcp_bpf.h" char _license[] SEC("license") = "GPL"; char cc[TCP_CA_NAME_MAX] = "reno"; int pid; /* Associ...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/strobemeta' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Facebook #include <stdint.h> #include <stddef.h> #include <stdbool.h> #include <linux/bpf.h> #include <linux/ptrace.h> #include <linux/sched.h> #include <linux/types.h> #include <bpf/bpf_helpers.h> #include "bpf_compiler.h" typedef uint32_t pid_t; struct...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_core_reloc_bitfields_direct' 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/recvmsg6_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/in6.h> #include <sys/socket.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #include <bpf_sockopt_helpers.h> #define SERV6_IP_0 0xfaceb00c /* face:b00c:1234:5678::abcd */ #define SERV6_IP_1 0x1234...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/task_kfunc_common' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ /* Copyright (c) 2022 Meta Platforms, Inc. and affiliates. */ #ifndef _TASK_KFUNC_COMMON_H #define _TASK_KFUNC_COMMON_H #include <errno.h> #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> struct __tasks_kfunc_map_value { struct task_struct __...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/sockmap_parse_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> SEC("sk_skb1") int bpf_prog1(struct __sk_buff *skb) { void *data_end = (void *)(long) skb->data_end; void *data = (void *)(long) skb->data; __u8 *d = data; int err; if (data + 10 > data_end) { err = bpf_skb_pull_data(skb, 10);...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/fentry_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("fentry/bpf_fentry_test1") int BPF_PROG(test1, int a) { test1_result = a == 1; return 0; } ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/unsupported_ops' 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" char _license[] SEC("license") = "GPL"; SEC("struct_ops/unsupported_ops") __failure __msg("attach to un...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_skb_ctx' 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_compiler.h" char _license[] SEC("license") = "GPL"; SEC("tc") int process(struct __sk_buff *skb) { __pragma_loop_unroll_full for (int i = 0; i < 5; i++) { if (skb->cb[i] != i + 1) return 1; skb->cb[i]...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/profiler2' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #define barrier_var(var) /**/ /* undef #define UNROLL */ #define INLINE /**/ #include "profiler.inc.h" ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_perf_branches' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Facebook #include <stddef.h> #include <linux/ptrace.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> int valid = 0; int run_cnt = 0; int required_size_out = 0; int written_stack_out = 0; int written_global_out = 0; stru...