instruction
stringlengths
82
202
input
stringclasses
1 value
output
stringlengths
73
23.9M
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_core_reloc_primitives' 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 = {}; enum core_reloc_primitives_enum { A = 0, B = 1...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_ksyms_btf' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Google */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> __u64 out__runqueues_addr = -1; __u64 out__bpf_prog_active_addr = -1; __u32 out__rq_cpu = -1; /* percpu struct fields */ int out__bpf_prog_active = -1; /* percpu int */ __u32 out__this_rq_cpu ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_ld_ind' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/ld_ind.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "../../../include/linux/filter.h" #include "bpf_misc.h" SEC("socket") __description("ld_ind: check calling conv, r1") __failure __msg("R1 !read_ok") ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/crypto_sanity' 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_tracing_net.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "bpf_kfuncs.h" #include "crypto_common.h" unsign...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_kptr_return_fail__wrong_type' 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/wq_failures' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 Benjamin Tissoires */ #include "bpf_experimental.h" #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #include "../test_kmods/bpf_testmod_kfunc.h" char _license[] SEC("license") = "GPL"; struct elem { struct bpf_wq w; }; struct { __uint(type, BPF_MA...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/fib_lookup' 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/types.h> #include <linux/bpf.h> #include <linux/pkt_cls.h> #include <bpf/bpf_helpers.h> struct bpf_fib_lookup fib_params = {}; int fib_lookup_ret = 0; int lookup_flags = 0; SEC("tc") int fib_lookup(...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/pyperf600' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Facebook #define STACK_MAX_LEN 600 /* Full unroll of 600 iterations will have total * program size close to 298k insns and this may * cause BPF_JMP insn out of 16-bit integer range. * So limit the unroll size to 150 so the * total program size is around...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_kptr_return_fail__local_kptr' 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_experimental.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 struc...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/sockmap_tcp_msg_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_msg1") int bpf_prog1(struct sk_msg_md *msg) { return SK_PASS; } char _license[] SEC("license") = "GPL"; ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_private_stack' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #include "bpf_experimental.h" /* From include/linux/filter.h */ #define MAX_BPF_STACK 512 #if defined(__TARGET_ARCH_x86) || defined(__TARGET_ARCH_arm64) struct elem { struct bpf_timer t; char pad[25...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/test_jhash' 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 <features.h> typedef unsigned int u32; static __always_inline u32 rol32(u32 word, unsigned int shift) { return (word << shift) | (word >> ((-shift) & 31)); } #define __jhash_mix(a, b, c) \ { \ a -= c; a ^= rol32(c, 4); c += b...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_and' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/and.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); __uin...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_global_func9' 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; }; struct C { int x; int y; }; struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 1); __type(key, __u32); __type(value, struct S); } map SEC...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_verify_pkcs7_sig' 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> #include "bpf_kfuncs.h" #include "err.h" #define MAX_DATA...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_seg6_loop' alt sistemi için gerekli C kaynak kodunu implemente et.
```c #include <stddef.h> #include <inttypes.h> #include <errno.h> #include <linux/seg6_local.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #include "bpf_compiler.h" /* Packet parsing state machine helpers. */ #define cursor_advance(_cursor, _len) \ ({ void *_tmp = _cursor; _curso...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/ksym_race' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include <bpf/bpf_helpers.h> extern int bpf_testmod_ksym_percpu __ksym; SEC("tc") int ksym_fail(struct __sk_buff *ctx) { return *(int *)bpf_this_cpu_ptr(&bpf_testmod_ksym_percpu); } char _license[] SEC("license") = "GPL"; ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/pro_epilogue_goto_start' 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"; __success /* prolo...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cgroup_skb_direct_packet_access' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "vmlinux.h" #include <bpf/bpf_helpers.h> __u32 data_end; SEC("cgroup_skb/ingress") int direct_packet_access(struct __sk_buff *skb) { data_end = skb->data_end; return 1; } char _license[] SEC("license") = "GPL"; ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/strobemeta_subprogs' 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 #define SUBPROGS #include "strobemeta.h" ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_smc' 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_tracing_net.h" char _license[] SEC("license") = "GPL"; #ifndef SMC_HS_CTRL_NAME_MAX #define SMC_HS_CTRL_NAME_MAX 16 #endif enum { BPF_SMC_LISTEN = 10, }; struct smc_sock___local {...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/mptcp_sock' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020, Tessares SA. */ /* Copyright (c) 2022, SUSE. */ #include "bpf_tracing_net.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; __u32 token = 0; struct mptcp_storage { __u32 invoked; __u32 is_mptcp; stru...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cgroup_iter' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022 Google */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; int terminate_early = 0; u64 terminal_cgroup = 0; static inline u64 cgroup_id(struct cgroup *cgrp) { return cgrp->kn->id; } ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_core_extern' 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 <stdbool.h> #include <linux/ptrace.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> /* non-existing BPF helper, to test dead code elimination */ static int (*bpf_missing_helper)(const void *arg1, int arg2) = ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_may_goto_1' 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" SEC("raw_tp") __description("may_goto 0") __arch_x86_64 __arch_s390x __arch_arm64 __xlated("0: r0 ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/empty_skb' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> char _license[] SEC("license") = "GPL"; int ifindex; int ret; SEC("lwt_xmit") int redirect_ingress(struct __sk_buff *skb) { ret = bpf_clone_redirect(skb, ifindex, BPF_F_INGRESS); ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_varlen' 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> #include <bpf/bpf_core_read.h> #define MAX_LEN 256 char buf_in1[MAX_LEN] = {}; char buf_in2[MAX_LEN] = {}; int test_pid = 0; bool capture = false; /* .bss */ __u...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/stacktrace_map' 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> #ifndef PERF_MAX_STACK_DEPTH #define PERF_MAX_STACK_DEPTH 127 #endif struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 1); __type(key, __u32); __type(value, __u32); } con...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/core_kern' 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> #define ATTR __always_inline #include "test_jhash.h" struct { __uint(type, BPF_MAP_TYPE_ARRAY); __type(key, u32); __type(value, u...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/token_lsm' 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> char _license[] SEC("license") = "GPL"; int my_pid; int reject_capable; int reject_cmd; SEC("lsm/bpf_token_capable") int BPF_PROG(toke...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_lwt_ip_encap' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <stddef.h> #include <string.h> #include <linux/bpf.h> #include <linux/ip.h> #include <linux/ipv6.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> struct grehdr { __be16 flags; __be16 protocol; }; SEC("encap_gre") int bpf_lwt_encap_gre(struct __sk_buff *sk...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_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/tcp.h> #include <linux/socket.h> #include <linux/bpf.h> #include <linux/types.h> #include <bpf/bpf_helpers.h> #include <b...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/connect_force_port4' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <string.h> #include <stdbool.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 ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_bpf_ma' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2023. Huawei Technologies Co., Ltd */ #include <vmlinux.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> #include "bpf_experimental.h" #include "bpf_misc.h" struct generic_map_value { void *data; }; char _license[] SEC("license") = "GPL"; const ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/decap_sanity' 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_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 init_csum_partial = false; bool ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_cgroup1_hierarchy' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2023 Yafang Shao <laoar.shao@gmail.com> */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_core_read.h> __u32 target_ancestor_level; __u64 target_ancestor_cgid; int target_pid, target_hid; struct cgroup *bpf_ta...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/stacktrace_ips' 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_tracing.h> #ifndef PERF_MAX_STACK_DEPTH #define PERF_MAX_STACK_DEPTH 127 #endif typedef __u64 stack_trace_t[PERF_MAX_STACK_DEPTH]; struct { __uint(type, BPF_MAP_TYPE_S...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/mptcp_bpf' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */ #ifndef __MPTCP_BPF_H__ #define __MPTCP_BPF_H__ #include "bpf_experimental.h" /* list helpers from include/linux/list.h */ static inline int list_is_head(const struct list_head *list, const struct list_head *head) { return list == head; } #def...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/user_ringbuf_fail' 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/test_get_stack_rawtp' 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> /* Permit pretty deep stack traces */ #define MAX_STACK_RAWTP 100 struct stack_trace_t { int pid; int kern_stack_size; int user_stack_size; int user_stack_buildid_size; __u64 kern_stack[MAX_STACK_RAWTP]; __u64 user_stac...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_dctcp_release' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include "bpf_tracing_net.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; const char cubic[] = "cubic"; SEC("struct_ops") void BPF_PROG(dctcp_nouse_release, struct sock *sk) { bpf_setsocko...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_sockmap_pass_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 kernel'inin 'tools/testing/selftests/bpf/progs/verifier_vfs_accept' 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 "bpf_misc.h" #include "bpf_experimental.h" static char buf[64]; SEC("lsm.s/file_open") __success int BPF_PROG(get_task_exe_file_and...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/rbtree' 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/bpf_core_read.h> #include "bpf_experimental.h" struct node_data { long key; long data; struct bpf_rb_node node; }; str...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/uptr_failure' 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_experimental.h" #include "bpf_misc.h" #include "uptr_test_common.h" struct { __uint(type, BPF_MAP_TYPE_TASK_STORAGE); __uint(map_flags, BPF_F_NO_PREA...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/loop3' 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(struct pt_regs *ctx) { volatile __u64 i = 0, sum = 0; do { i++; sum += P...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_ksyms_module' 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> #define X_0(x) #define X_1(x) x X_0(x) #define X_2(x) x X_1(x) #define X_3(x) x X_2(x) #define X_4(x) x X_3(x) #define X_5(x) x X_4(x) #define X_6(x) x X_5(x) #define X_7(x) x X_6(x) #define X_...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/test_cls_redirect' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* Copyright 2019, 2020 Cloudflare */ #include <stdbool.h> #include <stddef.h> #include <stdint.h> #include <string.h> #include <linux/if_ether.h> #include <linux/in.h> #include <linux/ip.h> #include <linux/ipv6.h> #include <netinet/udp.h> /* offsetof() is ...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/test_queue_stack_map' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ // Copyright (c) 2018 Politecnico di Torino #include <stddef.h> #include <string.h> #include <linux/bpf.h> #include <linux/if_ether.h> #include <linux/ip.h> #include <linux/pkt_cls.h> #include <bpf/bpf_helpers.h> struct { __uint(type, MAP_TYPE); __uint(max_entries, 32); _...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_lwt_reroute' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <inttypes.h> #include <linux/bpf.h> #include <bpf/bpf_endian.h> #include <bpf/bpf_helpers.h> #include <linux/if_ether.h> #include <linux/ip.h> /* This function extracts the last byte of the daddr, and uses it * as output dev index. */ SEC("lwt_xmit") int test_lwt_rer...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_global_map_resize' 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> char _license[] SEC("license") = "GPL"; /* rodata section */ const volatile pid_t pid; const volatile size_t bss_array_len; const volat...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/freplace_cls_redirect' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2020 Facebook #include <linux/stddef.h> #include <linux/bpf.h> #include <linux/pkt_cls.h> #include <bpf/bpf_endian.h> #include <bpf/bpf_helpers.h> struct { __uint(type, BPF_MAP_TYPE_SOCKMAP); __type(key, int); __type(value, int); __uint(max_entries, 2); } ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cpumask_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 "cpumask_common.h" char _license[] SEC("license") = "GPL"; int pid, nr_cpus; struct kptr_nested { str...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_dctcp' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2019 Facebook */ /* WARNING: This implementation is not necessarily the same * as the tcp_dctcp.c. The purpose is mainly for testing * the kernel BPF logic. */ #include "bpf_tracing_net.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #ifndef ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/getpeername6_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_IP6_0 0xfaceb00c #define REWRITE_ADDRESS_IP6_1 0x12345678 #defi...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/test_sockmap_kern' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ /* Copyright (c) 2017-2018 Covalent IO, Inc. http://covalent.io */ #include <stddef.h> #include <string.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/in.h> #include <linux/udp.h...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/priv_map' 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"; struct { __uint(type, BPF_MAP_TYPE_QUEUE); __uint(max_entries, 1); __type(value, __u32); } priv_map SEC(".maps"); ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_prevent_map_lookup' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/prevent_map_lookup.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" struct { __uint(type, BPF_MAP_TYPE_STACK_TRACE); __uint(max_entries, 1); __type(key, __u32); __type(value, __u64); } map...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/freplace_unreliable_prog' 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> SEC("freplace/btf_unreliable_kprobe") /* context type is what BPF verifier expects for kprobe context, but target * program has `stuct whatever *ctx` argument, so fre...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_ringbuf_multi' 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> char _license[] SEC("license") = "GPL"; struct sample { int pid; int seq; long value; char comm[16]; }; struct ringbuf_map { __uint(type, BPF_MAP_TYPE_RINGBUF); /* libbpf will adjust to ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/sockopt_sk' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <string.h> #include <linux/tcp.h> #include <linux/bpf.h> #include <netinet/in.h> #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; int page_size = 0; /* userspace should set it */ #ifndef SOL_TCP #define SOL_TCP IPPROTO_TCP #endif #define SOL_CUST...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_forgotten_cb' 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"; SEC("struct_ops/test_1") int BPF_PROG(test_1_forgotten) { return 0; } SEC(".struct_o...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/xdp_metadata' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include "xdp_metadata.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> struct { __uint(type, BPF_MAP_TYPE_XSKMAP); __uint(max_entries, 4); __type(key, __u32); __type(value, __u32); } xsk SEC(".maps"); struct { __uint(type, BPF_MAP_TYPE_PR...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_tcp6' 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/dynptr_success' 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 <string.h> #include <stdbool.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "errno.h" #define PAGE_SIZE_64K 65536 char _license[] SEC("license") = "GPL"; int pid, err...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cgroup_read_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" #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; char value[1...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/jeq_infer_not_null_fail' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #ifndef __clang__ #pragma GCC diagnostic ignored "-Warray-bounds" #endif char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_HASH); __uint(max_entries, 1); __type(key, u64); __...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_cfg' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/cfg.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" SEC("socket") __description("unreachable") __failure __msg("unreachable") __failure_unpriv __naked void unreachable(void) { asm volatile (...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_static_linked2' 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> /* 4-byte aligned .data */ static volatile int static_var1 = 5; static volatile int static_var2 = 6; int var2 = -1; /* 8-byte aligned .rodata */ const volatile long rovar2; /* same "subprog"...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_ksyms_weak' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Test weak ksyms. * * Copyright (c) 2021 Google */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> int out__existing_typed = -1; __u64 out__existing_typeless = -1; __u64 out__non_existent_typeless = -1; __u64 out__non_existent_typed = -1; /* existing weak symbols ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/lsm_tailcall' 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 <errno.h> #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_PROG_ARRAY); __uint(max_entries, 1); __uint(key_size, sizeof(__u32)); __ui...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_cgroup_link' 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> int calls = 0; int alt_calls = 0; SEC("cgroup_skb/egress") int egress(struct __sk_buff *skb) { __sync_fetch_and_add(&calls, 1); return 1; } SEC("cgroup_skb/egress") int egress_alt(struct __sk...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cg_storage_multi_egress_only' 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, struct bpf_cgro...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cg_storage_multi_isolated' 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, struct bpf_cgro...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_lirc_mode2_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // test ir decoder // // Copyright (C) 2018 Sean Young <sean@mess.org> #include <linux/bpf.h> #include <linux/lirc.h> #include <bpf/bpf_helpers.h> SEC("lirc_mode2") int bpf_decoder(unsigned int *sample) { if (LIRC_IS_PULSE(*sample)) { unsigned int duration = LIRC_VALUE(*sam...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/crypto_common' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ #ifndef _CRYPTO_COMMON_H #define _CRYPTO_COMMON_H #include "errno.h" #include <stdbool.h> struct bpf_crypto_ctx *bpf_crypto_ctx_create(const struct bpf_crypto_params *params, u32 params__sz, int *err) ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/xdp_hw_metadata' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include "xdp_metadata.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> struct { __uint(type, BPF_MAP_TYPE_XSKMAP); __uint(max_entries, 256); __type(key, __u32); __type(value, __u32); } xsk SEC(".maps"); __u64 pkts_skip = 0; __u64 pkts_fail...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_fsverity' 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_kfuncs.h" char _license[] SEC("license") = "GPL"; #ifndef SHA256_DIGEST_SIZE #define SHA256_DIGEST_SIZE 32 #endif #...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/get_func_args_fsession_test' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <errno.h> char _license[] SEC("license") = "GPL"; __u64 test1_result = 0; SEC("fsession/bpf_fentry_test1") int BPF_PROG(test1) { __u64 cnt = bpf_get_func_arg_cnt(ctx); __u64 a = 0, z = 0...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/timer_interrupt' 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_experimental.h" char _license[] SEC("license") = "GPL"; #define CLOCK_MONOTONIC 1 int preempt_count; int in_interrupt; int in_interrupt_cb; struct elem { struct bpf_timer t; }; st...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_attach_probe' 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 <errno.h> #include "bpf_misc.h" u32 dynamic_sz = 1; int kprobe2_res = 0; int kretprobe2_res = 0; int uprobe_byname_res = 0; int...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_core_reloc_mods' 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_mods_output { int a, b, c, d,...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cgroup_iter_memcg' 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_core_read.h> #include "cgroup_iter_memcg.h" char _license[] SEC("license") = "GPL"; /* The latest values read are stored here. */ struct memcg_query memcg_query SEC(".data.quer...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_pinning' 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_ARRAY); __uint(max_entries, 1); __type(key, __u32); __type(value, __u64); __uint(pinning, LIBBPF_PIN_BY_NAME); } pinmap SEC(".maps"); struct { __uint(type, BPF_MAP_TYPE_HASH); __uint...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_tc_edt' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <stdint.h> #include <linux/bpf.h> #include <linux/if_ether.h> #include <linux/stddef.h> #include <linux/in.h> #include <linux/ip.h> #include <linux/pkt_cls.h> #include <linux/tcp.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> /* the maximum delay we are wi...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/mmap_inner_array' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; struct inner_array_type { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(map_flags, BPF_F_MMAPABLE); __t...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/raw_tp_null' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ #include <vmlinux.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; int tid; int i; SEC("tp_btf/bpf_testmod_test_raw_tp_null_tp") int BPF_PROG(test_raw_tp_null, struct s...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_core_autosize' 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/bpf_core_read.h> char _license[] SEC("license") = "GPL"; /* fields of exactly the same size */ struct test_struct___samesize { void *ptr; unsigned long lo...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/uninit_stack' 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" /* Read an uninitialized value from stack at a fixed offset */ SEC("socket") __naked int read_uninit_stack_fixed_off(void *ctx) { asm volatile (" \ r0 = 0; \ /* force stack depth to be 128 *...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/kfunc_call_race' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include "../test_kmods/bpf_testmod_kfunc.h" SEC("tc") int kfunc_call_fail(struct __sk_buff *ctx) { bpf_testmod_test_mod_kfunc(0); return 0; } char _license[] SEC("license") = "GPL"; ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/trace_printk' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2020, Oracle and/or its affiliates. #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; int trace_printk_ret = 0; int trace_printk_ran = 0; int trace_printk_invalid_spec_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_urandom_usdt' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022 Meta Platforms, Inc. and affiliates. */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/usdt.bpf.h> int urand_pid; int urand_read_without_sema_call_cnt; int urand_read_without_sema_buf_sz_sum; SEC("usdt/./urandom_read:urand:read_without_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_loop' 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"; struct callback_ctx { int output; }; struct { __uint(type, BPF_MAP_TYPE_HASH); __uint(max_entries, 32); __type(key, int); __...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/get_cgroup_id_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2018 Facebook #include <linux/bpf.h> #include <bpf/bpf_helpers.h> __u64 cg_id; __u64 expected_pid; SEC("tracepoint/syscalls/sys_enter_nanosleep") int trace(void *ctx) { __u32 pid = bpf_get_current_pid_tgid(); if (expected_pid == pid) cg_id = bpf_get_curr...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/crypto_basic' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "bpf_kfuncs.h" #include "crypto_common.h" int status; SEC("syscall") int crypto_release(void *ctx) { str...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/metadata_unused' 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> volatile const char bpf_metadata_a[] SEC(".rodata") = "foo"; volatile const int bpf_metadata_b SEC(".rodata") = 1; SEC("cgroup_skb/egress") int prog(struct xdp_md *ctx) { return 0; } char _license[] SEC("license") = "...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/uprobe_multi_pid_filter' 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"; __u32 pids[3]; __u32 test[3][2]; static void update_pid(int idx) { __u32 pid = bpf_get_current_pid_tgid() >> 32; if (pid == pids[idx]) test[idx][0]++; ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_select_reuseport_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2018 Facebook */ #include <linux/in.h> #include <linux/ip.h> #include <linux/ipv6.h> #include <linux/tcp.h> #include <linux/udp.h> #include <linux/bpf.h> #include <linux/types.h> #include <linux/if_ether.h> #include <bpf/bpf_endian.h> #include <bpf/bpf_helpers...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/for_each_array_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_ARRAY); __uint(max_entries, 3); __type(key, __u32); __type(value, __u64); } arraymap SEC(".maps"); struct { __ui...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/get_func_args_test' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <errno.h> char _license[] SEC("license") = "GPL"; __u64 test1_result = 0; SEC("fentry/bpf_fentry_test1") int BPF_PROG(test1) { __u64 cnt = bpf_get_func_arg_cnt(ctx); __u64 a = 0, z = 0, r...