instruction
stringlengths
82
202
input
stringclasses
1 value
output
stringlengths
73
23.9M
Linux kernel'inin 'tools/testing/selftests/bpf/progs/kfunc_call_fail' 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 "../test_kmods/bpf_testmod_kfunc.h" struct syscall_test_args { __u8 data[16]; size_t size; }; SEC("?syscall") int kfunc_syscall_test_fail(struct syscall_test_args *args) { bpf_kfunc...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_usdt_multispec' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022 Meta Platforms, Inc. and affiliates. */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/usdt.bpf.h> /* this file is linked together with test_usdt.c to validate that usdt.bpf.h * can be included in multiple .bpf.c files forming single fin...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tc_dummy' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_legacy.h" SEC("tc") int entry(struct __sk_buff *skb) { return 1; } char __license[] SEC("license") = "GPL"; ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/strobemeta_nounroll1' 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 13 #define STROBE_MAX_MAP_ENTRIES 20 #define NO_UNROLL #include "strobemeta.h" ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/token_kallsyms' 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> char _license[] SEC("license") = "GPL"; __weak int token_ksym_subprog(void) { return 0; } SEC("xdp") int xdp_main(struct xdp_md *xdp) { return token_ksym_subprog...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_ksyms_btf_null_check' 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> extern const struct rq runqueues __ksym; /* struct type global var. */ extern const int bpf_prog_active __ksym; /* int type global var. */ SEC("raw_tp/sys_enter") int handler(const void *ctx)...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/sendmsg6_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 SRC_REWRITE_IP6_0 0 #define SRC_REWRITE_IP6_1 0 #define SRC_REWRITE_IP6_2...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/bpf_qdisc_common' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _BPF_QDISC_COMMON_H #define _BPF_QDISC_COMMON_H #define NET_XMIT_SUCCESS 0x00 #define NET_XMIT_DROP 0x01 /* skb dropped */ #define NET_XMIT_CN 0x02 /* congestion notification */ #define TC_PRIO_CONTROL 7 #de...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_tailcall' 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" struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 1); __type(key, __u32); __type(value, __u32); } map_array SEC(".maps"); SEC("socket") __description("invalid map type for tail call") _...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tailcall_bpf2bpf2' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_legacy.h" 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"); static __noinline int subprog_t...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_direct_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/direct_packet_access.c */ #include <linux/if_ether.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" SEC("tc") __description("pkt_end - pkt_start is allowed") __success __retval(TEST_DATA_LEN) __...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/arena_list' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ #define BPF_NO_KFUNC_PROTOTYPES #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_core_read.h> #include "bpf_experimental.h" struct { __uint(type, BPF_MAP_TYPE_ARENA); ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_global_func5' 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; } int f3(int, struct __sk_buff *skb); __attribute__ ((noinline)) i...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_qdisc_fq' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* bpf_fq is intended for testing the bpf qdisc infrastructure and not a direct * copy of sch_fq. bpf_fq implements the scheduling algorithm of sch_fq before * 29f834aa326e ("net_sched: sch_fq: add 3 bands and WRR scheduling") was * introduced. It gives each flow a fair chan...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_netfilter_retcode' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" SEC("netfilter") __description("bpf_exit with invalid return code. test1") __failure __msg("R0 is not a known value") __naked void with_invalid_return_code_test1(void) { asm volatile (" \ r0 = *(u6...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/load_bytes_relative' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * Copyright 2020 Google LLC. */ #include <errno.h> #include <linux/bpf.h> #include <linux/if_ether.h> #include <linux/ip.h> #include <bpf/bpf_helpers.h> struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 1); __type(key, __u32); __type(value, __u32); ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_overhead' 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> struct task_struct; SEC("kprobe/__set_task_comm") int BPF_KPROBE(prog1, struct task_struct *tsk, const char *buf, bool exec) { return !tsk; } SEC("kretprobe/__set...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_pinning_devmap' 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(max_entries, 1); __type(key, __u32); __type(value, __u32); __uint(pinning, LIBBPF_PIN_BY_NAME); } pinmap1 SEC(".maps"); struct { __uint(type, BPF_MAP_TYPE_DEVMAP); __...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/kprobe_multi_empty' 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"; SEC("kprobe.multi/") int test_kprobe_empty(struct pt_regs *ctx) { return 0; } ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/missed_kprobe_recursion' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "../test_kmods/bpf_testmod_kfunc.h" char _license[] SEC("license") = "GPL"; /* * No tests in here, just to trigger 'bpf_fentry_test*' * through tracing test_run */ SEC("fentry/bpf_modify...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_cls_redirect' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause // Copyright (c) 2019, 2020 Cloudflare #include <stdbool.h> #include <stddef.h> #include <stdint.h> #include <string.h> #include <linux/bpf.h> #include <linux/icmp.h> #include <linux/icmpv6.h> #include <linux/if_ether.h> #include <linux/in.h> #include <linux/ip...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_log_buf' 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> int a[4]; const volatile int off = 4000; SEC("raw_tp/sys_enter") int good_prog(const void *ctx) { a[0] = (int)(long)ctx; return a[1]; } SEC("raw_tp/sys_enter") int bad_prog(const void *ct...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_raw_stack' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/raw_stack.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" SEC("socket") __description("raw_stack: no skb_load_bytes") __success __failure_unpriv __msg_unpriv("invalid read from stack R6 off=-...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_global_data' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Isovalent, Inc. #include <linux/bpf.h> #include <linux/pkt_cls.h> #include <string.h> #include <bpf/bpf_helpers.h> struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 11); __type(key, __u32); __type(value, __u64); } result_number SEC(".map...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_tcp4' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include <vmlinux.h> #include "bpf_tracing_net.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> char _license[] SEC("license") = "GPL"; static int hlist_unhashed_lockless(const struct hlist_node *h) { return !(h->pprev); } ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_loop_bench' 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_misc.h" char _license[] SEC("license") = "GPL"; u32 nr_loops; long hits; static int empty_callback(__u32 index, void *data) { return 0; } static int outer_loop(__u32 index, vo...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_sockmap_ktls' 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 cork_byte; int push_start; int push_end; int apply_bytes; int pop_start; int pop_end; struct { __uint(type, BPF_MAP_TYPE_SOCKMAP); __uint(max_entries, 20); __type(key, int); __type(value, i...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_global_func_ctx_args' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_core_read.h> #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; static long stack[256]; /* * KPROBE conte...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_set_remove_xattr' 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 <errno.h> #include <bpf/bpf_tracing.h> #include "bpf_kfuncs.h" #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; __u32 monitored_pid; const char xattr_foo[] = "security.bp...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tcp_ca_incompl_cong_ops' 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"; SEC("struct_ops") __u32 BPF_PROG(incompl_cong_ops_ssthresh, struct sock *sk) { return tcp_sk(sk)->snd_ssthresh; } SEC("struct_ops") __u32 BPF_PROG(...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_sockmap' 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_tracing_net.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <errno.h> char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_SOCKMAP); __uint(max_entries, 64); _...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_kptr_return_fail__nonzero_offset' 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/iters_task_failure' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2023 Chuyi Zhou <zhouchuyi@bytedance.com> */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "bpf_experimental.h" char _license[] SEC("license") = "GPL"; struct cgroup *bpf_cgroup_from_id(u64 cgid)...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_skc_to_unix_sock' 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> #include "bpf_tracing_net.h" const volatile pid_t my_pid = 0; char path[256] = {}; SEC("fentry/unix_listen") int BPF_PROG(unix_listen, struct socket *sock, i...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_unpriv_bpf_disabled' 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_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" __u32 perfbuf_val = 0; __u32 ringbuf_val = 0; int test_pid; struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_e...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cgroup_storage' 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_CGROUP_STORAGE); __type(key, struct bpf_cgroup_storage_key); __type(value, __u64); } cgroup_storage SEC(".maps"); SEC("cgroup_skb/egress") int bpf_prog(struct __sk_buff *skb) { __u64 *c...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_spin_lock_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_experimental.h" struct foo { struct bpf_spin_lock lock; int data; }; struct array_map { __uint(type, BPF_MAP_TYPE_ARRAY); __type(key, int); __type(value, struct foo); __uint(max_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/fexit_many_args' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Tencent */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; __u64 test1_result = 0; SEC("fexit/bpf_testmod_fentry_test7") int BPF_PROG(test1, __u64 a, void *b, short c, int d, void *e...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_ns_current_pid_tgid' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2019 Carlos Neira cneirabustos@gmail.com */ #include <linux/bpf.h> #include <stdint.h> #include <bpf/bpf_helpers.h> struct { __uint(type, BPF_MAP_TYPE_SOCKMAP); __uint(max_entries, 2); __type(key, __u32); __type(value, __u32); } sock_map SEC(".maps"); __u...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bench_local_storage_create' 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_tracing_net.h" #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> long create_errs = 0; long create_cnts = 0; __u32 bench_pid = 0; struct storage { __u8 data[64]; }; stru...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tcp_ca_write_sk_pacing' 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"; #define USEC_PER_SEC 1000000UL static unsigned int tcp_left_out(const struct tcp_sock *tp) { return tp->sacked_out + tp->lost_out; } static unsign...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_btf_unreliable_prog' 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> #include <bpf/bpf_tracing.h> #include <bpf/bpf_core_read.h> #include "bpf_misc.h" struct whatever {}; SEC("kprobe") __success __log_level(2) /* context type is wrong, making it impossible to frep...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_sockhash_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2018 Covalent IO, Inc. http://covalent.io #undef SOCKMAP #define TEST_MAP_TYPE BPF_MAP_TYPE_SOCKHASH #include "./test_sockmap_kern.h" ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cg_storage_multi_shared' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * Copyright 2020 Google LLC. */ #include <errno.h> #include <linux/bpf.h> #include <linux/ip.h> #include <linux/udp.h> #include <bpf/bpf_helpers.h> #include "progs/cg_storage_multi.h" struct { __uint(type, BPF_MAP_TYPE_CGROUP_STORAGE); __type(key, __u64); __type...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_attach_kprobe_sleepable' 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> #include <bpf/bpf_tracing.h> #include <bpf/bpf_core_read.h> #include "bpf_misc.h" int kprobe_res = 0; /** * This program will be manually made sleepable on the userspace side * and should thus ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_search_pruning' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/search_pruning.c */ #include <linux/bpf.h> #include <../../../include/linux/filter.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #define MAX_ENTRIES 11 struct test_val { unsigned int index; int foo[MAX_ENTRIES];...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/uprobe_multi_consumers' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <stdbool.h> #include "bpf_kfuncs.h" #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; __u64 uprobe_result[4]; SEC("uprobe.multi") int uprobe_0(struct pt_regs *ctx) { uprobe_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_build_id' 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> struct bpf_stack_build_id stack_sleepable[128]; int res_sleepable; struct bpf_stack_build_id stack_nofault[128]; int res_nofault; SEC("uprobe.multi/./uprobe_multi:...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/fexit_bpf2bpf' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2019 Facebook */ #include <linux/stddef.h> #include <linux/if_ether.h> #include <linux/ipv6.h> #include <linux/bpf.h> #include <linux/tcp.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #include <bpf/bpf_tracing.h> struct sk_buff { unsigned int len...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/prepare' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2025 Meta */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; int err; struct { __uint(type, BPF_MAP_TYPE_RINGBUF); __uint(max_entries, 4096); } ringbuf SEC(".maps"); struct { __uint(type, BPF_MAP_TYPE_ARRAY); __u...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_trampoline_count' 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> SEC("fentry/bpf_testmod_trampoline_count_test") int BPF_PROG(fentry_test) { return 0; } SEC("fmod_ret/bpf_testmod_trampoline_count_test") int BPF_PROG(fmod_ret_test, int ret) { return 0; } SEC(...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/arena_atomics' 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 <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <stdbool.h> #include <stdatomic.h> #include "bpf_arena_common.h" #include "../../../include/linux/filter.h" #include "bpf_misc....
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_movsx' 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" #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ defined(__...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tailcall_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/bpf_helpers.h> #include <bpf/bpf_core_read.h> #include "bpf_misc.h" #include "bpf_experimental.h" extern void bpf_rcu_read_lock(void) __ksym; extern vo...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_xdp_update_frags' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * 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> #include <bpf/bpf_helpers.h> i...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tailcall_bpf2bpf6' 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" #define __unused __attribute__((unused)) 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("....
Linux kernel'inin 'tools/testing/selftests/bpf/progs/nested_trust_success' 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/struct_ops_maybe_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 "../test_kmods/bpf_testmod.h" char _license[] SEC("license") = "GPL"; pid_t tgid = 0; SEC("struct_ops/test_maybe_null_struct_ptr") int BPF_PROG(test_maybe_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_spin_lock' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/spin_lock.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); __type(key,...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_refcounted_fail__ref_leak' 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"; /* Test that the verifier rejects a program that acquires a referenced * kptr through context without releasing the reference */ SEC("struct_ops/test_refcounted...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_subskeleton_lib2' 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 <linux/bpf.h> #include <bpf/bpf_helpers.h> int var6 = 6; struct { __uint(type, BPF_MAP_TYPE_HASH); __type(key, __u32); __type(value, __u32); __uint(max_entries, 16); } map2 SEC(".maps"); char LICENSE[] SEC...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tracing_struct_many_args' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> struct bpf_testmod_struct_arg_4 { u64 a; int b; }; struct bpf_testmod_struct_arg_5 { char a; short b; int c; long d; }; long t7_a, t7_b, t7_c, t7_d, t7_e, t7_f_a, t7_f_b, t7_ret; long t8_a, t...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tailcall5' 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/task_work_stress' 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" #define ENTRIES 128 char _license[] SEC("license") = "GPL"; __u64 callb...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_cgroup_skb' 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_skb.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" SEC("cgroup/skb") __description("direct packet read test#1 for CGROUP_SKB") __success __failure_unpriv __msg_unpriv("invalid bpf_con...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/connect_force_port6' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <string.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> #include <bpf_sockopt_helpers.h> char _license[] SEC("license") = "GPL"; __u16 port = 0; struct svc_addr...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_autocreate2' 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(foo) { test_1_result = 42; return 0; } SEC("?struct_ops/test_1") int BPF_PROG(bar) { tes...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/uprobe_multi' 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> char _license[] SEC("license") = "GPL"; __u64 uprobe_multi_func_1_addr = 0; __u64 uprobe_multi_func_2_addr = 0; __u64 uprobe_multi_func_3_addr = 0; __u64 uprobe_multi_func...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tailcall_bpf2bpf_fentry' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright Leon Hwang */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> int count = 0; SEC("fentry/subprog_tail") int BPF_PROG(fentry, struct sk_buff *skb) { count++; return 0; } char _license[] SEC("license") = "GPL"; ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_arena_globals1' 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_experimental.h" #include "bpf_arena_common.h" #include "bpf_misc.h" #define ARENA_PAGES (1...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_vfs_reject' 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 <errno.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <linux/limits.h> #include "bpf_misc.h" #include "bpf_experimental.h" static char buf[PATH_MAX]; SEC("lsm.s/file_open") __failure __...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/kprobe_multi_override' 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 pid = 0; SEC("kprobe.multi") int test_override(struct pt_regs *ctx) { if (bpf_get_current_pid_tgid() >> 32 != pid) return 0; bpf_override_return(c...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/trace_dummy_st_ops' 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> int val = 0; SEC("fentry/test_1") int BPF_PROG(fentry_test_1, __u64 *st_ops_ctx) { __u64 state; /* Read the traced st_ops arg1 which is a pointer */ bpf_probe_read_kernel(&state, sizeof(__u64)...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/task_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 "task_kfunc_common.h" char _license[] SEC("license") = "GPL"; /* Prototype for all of the program trace...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_btf_ext' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2025 Meta Platforms Inc. */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; __noinline static void f0(void) { __u64 a = 1; __sink(a); } SEC("xdp") __u64 global_func(struct xdp_md *xdp)...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_ref_tracking' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/ref_tracking.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "../../../include/linux/filter.h" #include "bpf_misc.h" #define BPF_SK_LOOKUP(func) \ /* struct bpf_sock_tuple tuple = {} */ \ "r2 = 0;" \ ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/uretprobe_stack' 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 <bpf/usdt.bpf.h> char _license[] SEC("license") = "GPL"; __u64 entry_stack1[32], exit_stack1[32]; __u64 entry_stack1_recur[32],...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cgroup_getset_retval_hooks' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #define BPF_RETVAL_HOOK(name, section, ctx, expected_err) \ __attribute__((__section__("?" section))) \ int name(struct ctx *_ctx) \ { \ bpf_set_retval(bpf_get_retval()); \ return 1; \ } #include "cgroup_getset_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_ctx' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/ctx.c */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #include "../test_kmods/bpf_testmod_kfunc.h" static const char ctx_strncmp_target[] = "ctx"; static const char ctx_snprintf_fmt[] = ""; SEC(...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/exceptions' 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/bpf_endian.h> #include "bpf_misc.h" #include "bpf_experimental.h" #ifndef ETH_P_IP #define ETH_P_IP 0x0800 #endif struct { __uint(type, BPF_MAP_TYPE_PRO...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_helper_access_var_len' 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_access_var_len.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_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_sk_lookup_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* SPDX-License-Identifier: GPL-2.0 */ // Copyright (c) 2018 Covalent IO, Inc. http://covalent.io #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_cls.h> #include ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_udp4' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include <vmlinux.h> #include "bpf_tracing_net.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> char _license[] SEC("license") = "GPL"; static long sock_i_ino(const struct sock *sk) { const struct socket *sk_socket = sk->sk_socket;...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/profiler' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #pragma once #define TASK_COMM_LEN 16 #define MAX_ANCESTORS 4 #define MAX_PATH 256 #define KILL_TARGET_LEN 64 #define CTL_MAXNAME 10 #define MAX_ARGS_LEN 4096 #define MAX_FILENAME_LEN 512 #define MAX_ENVIRON_LEN 8192 #define MAX_PATH_DEPTH 32 #...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/clone_attach_btf_id' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2025 Meta */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; SEC("fentry/bpf_fentry_test1") int BPF_PROG(fentry_handler, int a) { return 0; } ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_time_tai' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2022 Linutronix GmbH */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; SEC("tc") int time_tai(struct __sk_buff *skb) { __u64 ts1, ts2; /* Get TAI timestamps */ ts1 = bpf_ktime_get_tai_ns(); ts2 = bpf_ktime_get...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_sk_storage_tracing' 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_core_read.h> #include <bpf/bpf_helpers.h> struct sk_stg { __u32 pid; __u32 last_notclose_state; char comm[16]; }; struct { __uint(type, BPF_MAP_TYPE_SK_STORAGE); __uint(...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_bounds_mix_sign_unsign' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/bounds_mix_sign_unsign.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/task_local_storage_exit_creds' 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"; struct { __uint(type, BPF_MAP_TYPE_TASK_STORAGE); __uint(map_flags, BPF_F_NO_PREALLOC); __type(key, int); __type(value,...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/recvmsg_unix_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 <string.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> #include "bpf_kfuncs.h" __u8 SERVUN_ADDRESS[] = "\0bpf_cgroup_unix_test"; SEC("cgroup/recvmsg_unix") int recvmsg...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/local_kptr_stash_fail' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_core_read.h> #include "../bpf_experimental.h" #include "bpf_misc.h" struct node_data { long key; long data; struct ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_tc_link' 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/stddef.h> #include <linux/if_packet.h> #include <bpf/bpf_endian.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> char LICENSE[] SEC("license...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/uprobe_multi_verifier' 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 "bpf_misc.h" char _license[] SEC("license") = "GPL"; SEC("uprobe.session") __success int uprobe_sesison_return_0(struct pt_regs *ctx) { return 0; } SEC("uprobe....
Linux kernel'inin 'tools/testing/selftests/bpf/progs/xdp_tx' 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_tx(struct xdp_md *xdp) { return XDP_TX; } char _license[] SEC("license") = "GPL"; ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_subskeleton' 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, compiler may assume 0 otherwise */ const volatile int rovar1; int out1; /* Override weak symbol in test_subskeleton_l...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/missed_kprobe' 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_kfunc.h" char _license[] SEC("license") = "GPL"; /* * No tests in here, just to trigger 'bpf_fentry_test*' * through tracing test_run */ SEC("fentry/bpf_modify...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_attach_probe_manual' 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> #include <bpf/bpf_tracing.h> #include <bpf/bpf_core_read.h> #include "bpf_misc.h" int kprobe_res = 0; int kretprobe_res = 0; int uprobe_res = 0; int uretprobe_res = 0; int uprobe_byname_res = 0; v...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/timer_mim' 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/free_timer' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2025. Huawei Technologies Co., Ltd */ #include <linux/bpf.h> #include <time.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> #define MAX_ENTRIES 8 /* clang considers 'sum += 1' as usage but 'sum++' as non-usage. GCC * is more consistent and consi...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/percpu_alloc_array' alt sistemi için gerekli C kaynak kodunu implemente et.
```c #include "bpf_experimental.h" struct val_t { long b, c, d; }; struct elem { long sum; struct val_t __percpu_kptr *pc; }; struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 1); __type(key, int); __type(value, struct elem); } array SEC(".maps"); void bpf_rcu_read_lock(void) __ksym; void bpf_rc...