instruction stringlengths 82 202 | input stringclasses 1
value | output stringlengths 73 23.9M |
|---|---|---|
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/timer_start_delete_race' 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. */
#define _GNU_SOURCE
#include <sched.h>
#include <pthread.h>
#include <test_progs.h>
#include "timer_start_delete_race.skel.h"
/*
* Test for race between bpf_timer_start() and map element deletion.
*
* The race sce... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/kmem_cache_iter' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2024 Google */
#include <test_progs.h>
#include <bpf/libbpf.h>
#include <bpf/btf.h>
#include "kmem_cache_iter.skel.h"
#define SLAB_NAME_MAX 32
struct kmem_cache_result {
char name[SLAB_NAME_MAX];
long obj_size;
};
static void subtest_kmem_cache_iter_check... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/task_local_storage' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2021 Facebook */
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <unistd.h>
#include <sched.h>
#include <pthread.h>
#include <sys/syscall.h> /* For SYS_xxx definitions */
#include <sys/types.h>
#include <sys/eventfd.h>
#include <sys/mman... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/get_stackid_cannot_attach' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2020 Facebook
#include <test_progs.h>
#include "test_stacktrace_build_id.skel.h"
void test_get_stackid_cannot_attach(void)
{
struct perf_event_attr attr = {
/* .type = PERF_TYPE_SOFTWARE, */
.type = PERF_TYPE_HARDWARE,
.config = PERF_COUNT_HW_CPU_CYCLES,... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/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 <test_progs.h>
#include <bpf/btf.h>
#include "test_unpriv_bpf_disabled.skel.h"
#include "cap_helpers.h"
#include "bpf_util.h"
#include "sysctl_helpers.h"
/* Using CAP_LAST_CAP is risky here, since it can get pu... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/fexit_sleep' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2021 Facebook */
#define _GNU_SOURCE
#include <sched.h>
#include <test_progs.h>
#include <time.h>
#include <sys/mman.h>
#include <sys/syscall.h>
#include "fexit_sleep.lskel.h"
static int do_sleep(void *skel)
{
struct fexit_sleep_lskel *fexit_skel = skel;
stru... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/modify_return' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright 2020 Google LLC.
*/
#include <test_progs.h>
#include <unistd.h>
#include "modify_return.skel.h"
#define LOWER(x) ((x) & 0xffff)
#define UPPER(x) ((x) >> 16)
static void run_test(__u32 input_retval, __u16 want_side_effect, __s16 want_ret)
{
struct modify_re... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/xdp_do_redirect' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
#include <network_helpers.h>
#include <net/if.h>
#include <linux/if_ether.h>
#include <linux/if_packet.h>
#include <linux/if_link.h>
#include <linux/ipv6.h>
#include <linux/in6.h>
#include <netinet/udp.h>
#include <bpf/bpf_endian.h>
#include <uapi/linux/n... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/lsm_bdev' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2026 Christian Brauner <brauner@kernel.org> */
/*
* Test BPF LSM block device integrity hooks with dm-verity.
*
* Creates a dm-verity device over loopback, which triggers
* security_bdev_setintegrity() during verity_preresume().
* Verifies that the BPF pro... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/ringbuf_multi' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#define _GNU_SOURCE
#include <test_progs.h>
#include <sys/epoll.h>
#include "test_ringbuf_multi.skel.h"
static int duration = 0;
struct sample {
int pid;
int seq;
long value;
char comm[16];
};
static int process_sample(void *ctx, void *data, size_t len)
{
int ring = (uns... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/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 <sys/types.h>
#include <unistd.h>
#include <test_progs.h>
#include "cgroup_helpers.h"
#include "test_cgroup1_hierarchy.skel.h"
static void bpf_cgroup1(struct test_cgroup1_hierarchy *skel)
{
struct bpf_link *... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/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. */
#include <test_progs.h>
#include <sys/mman.h>
#include <network_helpers.h>
#include <sys/user.h>
#ifndef PAGE_SIZE /* on some archs it comes in sys/user.h */
#include <unistd.h>
#define PAGE_SIZE getpagesize()
#endif
... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/tcp_estats' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
void test_tcp_estats(void)
{
const char *file = "./test_tcp_estats.bpf.o";
int err, prog_fd;
struct bpf_object *obj;
err = bpf_prog_test_load(file, BPF_PROG_TYPE_TRACEPOINT, &obj, &prog_fd);
if (!ASSERT_OK(err, ""))
return;
bpf_object__close(ob... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/tc_opts' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2023 Isovalent */
#include <uapi/linux/if_link.h>
#include <net/if.h>
#include <test_progs.h>
#define loopback 1
#define ping_cmd "ping -q -c1 -w1 127.0.0.1 > /dev/null"
#include "test_tc_link.skel.h"
#include "tc_helpers.h"
void test_ns_tc_opts_basic(void)
{... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/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 <test_progs.h>
#include <network_helpers.h>
void test_load_bytes_relative(void)
{
int server_fd, cgroup_fd, prog_fd, map_fd, client_fd;
int err;
struct bpf_object *obj;
struct bpf_program *prog;
struct bpf_map *test_resu... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_overhead' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2019 Facebook */
#define _GNU_SOURCE
#include <sched.h>
#include <sys/prctl.h>
#include <test_progs.h>
#define MAX_CNT 100000
static __u64 time_get_ns(void)
{
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return ts.tv_sec * 1000000000ull + ... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_tunnel' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
/*
* End-to-end eBPF tunnel test suite
* The file tests BPF network tunnel implementation.
*
* Topology:
* ---------
* root namespace | at_ns0 namespace
* |
* ----------- | -----------
* | tnl dev | ... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/tc_redirect' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
/*
* This test sets up 3 netns (src <-> fwd <-> dst). There is no direct veth link
* between src and dst. The netns fwd has veth links to each src and dst. The
* client is in src and server in dst. The test installs a TC BPF program to each
* host facing vet... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/libbpf_probes' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2021 Facebook */
#include <test_progs.h>
#include <bpf/btf.h>
void test_libbpf_probe_prog_types(void)
{
struct btf *btf;
const struct btf_type *t;
const struct btf_enum *e;
int i, n, id;
btf = btf__parse("/sys/kernel/btf/vmlinux", NULL);
if (!ASSERT_... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/pkt_md_access' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
#include <network_helpers.h>
void test_pkt_md_access(void)
{
const char *file = "./test_pkt_md_access.bpf.o";
struct bpf_object *obj;
int err, prog_fd;
LIBBPF_OPTS(bpf_test_run_opts, topts,
.data_in = &pkt_v4,
.data_size_in = sizeof(pkt_v4),
.r... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/cgroup_storage' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <unistd.h>
#include <sys/socket.h>
#include <test_progs.h>
#include "cgroup_helpers.h"
#include "network_helpers.h"
#include "cgroup_storage.skel.h"
#define TEST_CGROUP "/test-bpf-cgroup-storage-buf/"
#define TEST_NS "cgroup_storage_ns"
#define PING_CMD "ping localhos... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/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 <sys/types.h>
#include <bpf/bpf.h>
#include <bpf/libbpf.h>
#include "test_progs.h"
#include "network_helpers.h"
#include "test_sk_storage_trace_itself.skel.h"
#include "test_sk_storage_tracing.skel.h"
#define LO_ADDR6 "::1"
#define TE... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/bpftool_maps_access' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0-only
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdint.h>
#include <sys/stat.h>
#include <stdbool.h>
#include <linux/bpf.h>
#include <bpf/libbpf.h>
#include <bpftool_helpers.h>
#include <test_progs.h>
#include <bpf/bpf.h>
#include "security_bpf_map.ske... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/ksyms' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2019 Facebook */
#include <test_progs.h>
#include "test_ksyms.skel.h"
#include <sys/stat.h>
void test_ksyms(void)
{
const char *btf_path = "/sys/kernel/btf/vmlinux";
struct test_ksyms *skel;
struct test_ksyms__data *data;
__u64 link_fops_addr, per_cpu_star... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2020 Carlos Neira cneirabustos@gmail.com */
#define _GNU_SOURCE
#include <test_progs.h>
#include "test_ns_current_pid_tgid.skel.h"
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <sched.h>
#include <sys/wait.h>... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/socket_cookie' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2020 Google LLC.
// Copyright (c) 2018 Facebook
#include <test_progs.h>
#include "socket_cookie_prog.skel.h"
#include "network_helpers.h"
static int duration;
struct socket_cookie {
__u64 cookie_key;
__u32 cookie_value;
};
void test_socket_cookie(void)
{
... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2019 Facebook */
#include <test_progs.h>
#include <network_helpers.h>
#include <bpf/btf.h>
#include "bind4_prog.skel.h"
#include "freplace_progmap.skel.h"
#include "xdp_dummy.skel.h"
typedef int (*test_cb)(struct bpf_object *obj);
static int check_data_map(str... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/prepare' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2025 Meta */
#include <test_progs.h>
#include <network_helpers.h>
#include "prepare.skel.h"
static bool check_prepared(struct bpf_object *obj)
{
bool is_prepared = true;
const struct bpf_map *map;
bpf_object__for_each_map(map, obj) {
if (bpf_map__fd(map)... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/task_fd_query_tp' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
static void test_task_fd_query_tp_core(const char *probe_name,
const char *tp_name)
{
const char *file = "./test_tracepoint.bpf.o";
int err, bytes, efd, prog_fd, pmu_fd;
struct perf_event_attr attr = {};
__u64 probe_offset, probe_addr;
__... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/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 <test_progs.h>
#include "arena_atomics.skel.h"
static void test_add(struct arena_atomics *skel)
{
LIBBPF_OPTS(bpf_test_run_opts, topts);
int err, prog_fd;
/* No need to attach it, just run it directly */... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/netfilter_link_attach' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0-or-later
#include <netinet/in.h>
#include <linux/netfilter.h>
#include "test_progs.h"
#include "test_netfilter_link_attach.skel.h"
struct nf_link_test {
__u32 pf;
__u32 hooknum;
__s32 priority;
__u32 flags;
bool expect_success;
const char * const name;
};
static const... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_xdp_veth' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Create 3 namespaces with 3 veth peers, and forward packets in-between using
* native XDP
*
* Network topology:
* ---------- ---------- ----------
* | NS1 | | NS2 | | NS3 |
* | veth11 | | veth22 | | veth33 |
* ----|--... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/btf_map_in_map' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2020 Facebook */
#include <test_progs.h>
#include "test_btf_map_in_map.skel.h"
static int duration;
static __u32 bpf_map_id(struct bpf_map *map)
{
struct bpf_map_info info;
__u32 info_len = sizeof(info);
int err;
memset(&info, 0, info_len);
err = bpf_m... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/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 <test_progs.h>
#include <string.h>
#include <stdio.h>
#include "task_work_stress.skel.h"
#include <linux/bpf.h>
#include <linux/perf_event.h>
#include <sys/syscall.h>
#include <time.h>
#include <stdlib.h>
#in... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/d_path' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#define _GNU_SOURCE
#include <test_progs.h>
#include <sys/stat.h>
#include <linux/sched.h>
#include <sys/syscall.h>
#define MAX_PATH_LEN 128
#define MAX_FILES 7
#include "test_d_path.skel.h"
#include "test_d_path_check_rdonly_mem.skel.h"
#include "test_d_path_check_types.ske... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/tc_netkit' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2023 Isovalent */
#include <uapi/linux/if_link.h>
#include <net/if.h>
#include <test_progs.h>
#define netkit_peer "nk0"
#define netkit_name "nk1"
#define ping_addr_neigh 0x0a000002 /* 10.0.0.2 */
#define ping_addr_noneigh 0x0a000003 /* 10.0.0.3 */
#include "... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_struct_ops_kptr_return' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
#include <test_progs.h>
#include "struct_ops_kptr_return.skel.h"
#include "struct_ops_kptr_return_fail__wrong_type.skel.h"
#include "struct_ops_kptr_return_fail__invalid_scalar.skel.h"
#include "struct_ops_kptr_return_fail__nonzero_offset.skel.h"
#include "struct_ops_kptr_return_fail__local_kptr.skel.h"
void tes... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_btf_ext' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2025 Meta Platforms Inc. */
#include <test_progs.h>
#include "test_btf_ext.skel.h"
#include "btf_helpers.h"
static void subtest_line_func_info(void)
{
struct test_btf_ext *skel;
struct bpf_prog_info info;
struct bpf_line_info line_info[128], *libbpf_line_inf... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/map_ops' 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 <errno.h>
#include <sys/syscall.h>
#include <unistd.h>
#include "test_map_ops.skel.h"
#include "test_progs.h"
static void map_update(void)
{
(void)syscall(__NR_getpid);
}
static void map_delete(void)
{
... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/l4lb_all' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
#include <network_helpers.h>
static void test_l4lb(const char *file)
{
unsigned int nr_cpus = bpf_num_possible_cpus();
struct vip key = {.protocol = 6};
struct vip_meta {
__u32 flags;
__u32 vip_num;
} value = {.vip_num = VIP_NUM};
__u32 stats_ke... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/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 <test_progs.h>
#include "uretprobe_stack.skel.h"
#include "../sdt.h"
/* We set up target_1() -> target_2() -> target_3() -> target_4() -> USDT()
* call chain, each being traced by our BPF program. On entry... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/obj_name' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
void test_obj_name(void)
{
struct {
const char *name;
int success;
int expected_errno;
} tests[] = {
{ "", 1, 0 },
{ "_123456789ABCDE", 1, 0 },
{ "_123456789ABCDEF", 0, EINVAL },
{ "_123456789ABCD\n", 0, EINVAL },
};
struct bpf_insn pro... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/cg_storage_multi' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright 2020 Google LLC.
*/
#include <test_progs.h>
#include <cgroup_helpers.h>
#include <network_helpers.h>
#include "progs/cg_storage_multi.h"
#include "cg_storage_multi_egress_only.skel.h"
#include "cg_storage_multi_isolated.skel.h"
#include "cg_storage_mult... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/exceptions' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
#include <network_helpers.h>
#include "exceptions.skel.h"
#include "exceptions_ext.skel.h"
#include "exceptions_fail.skel.h"
#include "exceptions_assert.skel.h"
static char log_buf[1024 * 1024];
static void test_exceptions_failure(void)
{
RUN_TESTS(ex... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/send_signal_sched_switch' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <pthread.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "test_send_signal_kern.skel.h"
static void sigusr1_handler(int signum)
{
}
#define THREAD_COUNT 10... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/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 <test_progs.h>
#include "clone_attach_btf_id.skel.h"
/*
* Test that bpf_program__clone() respects caller-provided attach_btf_id
* override via bpf_prog_load_opts.
*
* The BPF program has SEC("fentry/bpf_fentry_test1"). Clone it twice
... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/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 <test_progs.h>
#include "test_build_id.skel.h"
static char build_id[BPF_BUILD_ID_SIZE];
static int build_id_sz;
static void print_stack(struct bpf_stack_build_id *stack, int frame_cnt)
{
int i, j;
for (... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_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 <test_progs.h>
#include "struct_ops_multi_pages.skel.h"
static void do_struct_ops_multi_pages(void)
{
struct struct_ops_multi_pages *skel;
struct bpf_link *link;
/* The size of all trampolines of skel->... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/btf_tag' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2021 Facebook */
#include <test_progs.h>
#include <bpf/btf.h>
#include "test_btf_decl_tag.skel.h"
/* struct btf_type_tag_test is referenced in btf_type_tag.skel.h */
struct btf_type_tag_test {
int **p;
};
#include "btf_type_tag.skel.h"
#include "btf_typ... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/pinning' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <test_progs.h>
__u32 get_map_id(struct bpf_object *obj, const char *name)
{
struct bpf_map_info map_info = {};
__u32 map_info_len, duration = 0;
struct bpf_map *map;
int err;
map_info_len = sizeof(... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/timer_mim' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2021 Facebook */
#include <test_progs.h>
#include "timer_mim.skel.h"
#include "timer_mim_reject.skel.h"
static int timer_mim(struct timer_mim *timer_skel)
{
__u64 cnt1, cnt2;
int err, prog_fd, key1 = 1;
LIBBPF_OPTS(bpf_test_run_opts, topts);
err = timer_mi... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/percpu_array_inner_map' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
/*
* Test that replacing an inner percpu array map with one that has different
* max_entries is rejected. percpu_array_map_gen_lookup() inlines the
* template's index_mask, so allowing a smaller replacement would cause OOB.
*/
void test_percpu_array... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/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 */
#define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>
#include <test_progs.h>
#include "free_timer.skel.h"
struct run_ctx {
struct bpf_program *start_prog;
struct bpf_program *overwrite_prog;
pthread_barrier_... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/btf_dump' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
#include <bpf/btf.h>
static int duration = 0;
void btf_dump_printf(void *ctx, const char *fmt, va_list args)
{
vfprintf(ctx, fmt, args);
}
static struct btf_dump_test_case {
const char *name;
const char *file;
bool known_ptr_sz;
} btf_dump_test_cas... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/bad_struct_ops' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
#include "bad_struct_ops.skel.h"
#include "bad_struct_ops2.skel.h"
static void invalid_prog_reuse(void)
{
struct bad_struct_ops *skel;
char *log = NULL;
int err;
skel = bad_struct_ops__open();
if (!ASSERT_OK_PTR(skel, "bad_struct_ops__open"))
re... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/lwt_ip_encap' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0-only
#include <netinet/in.h>
#include "network_helpers.h"
#include "test_progs.h"
#define BPF_FILE "test_lwt_ip_encap.bpf.o"
#define NETNS_NAME_SIZE 32
#define NETNS_BASE "ns-lwt-ip-encap"
#define IP4_ADDR_1 "172.16.1.100"
#define IP4_ADDR_2 "172.16.2.100"
#define IP4_ADDR_3... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/jit_probe_mem' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2022 Meta Platforms, Inc. and affiliates. */
#include <test_progs.h>
#include <network_helpers.h>
#include "jit_probe_mem.skel.h"
void test_jit_probe_mem(void)
{
LIBBPF_OPTS(bpf_test_run_opts, opts,
.data_in = &pkt_v4,
.data_size_in = sizeof(pkt_v4),
.r... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/setget_sockopt' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) Meta Platforms, Inc. and affiliates. */
#define _GNU_SOURCE
#include <sched.h>
#include <linux/socket.h>
#include <linux/tls.h>
#include <net/if.h>
#include "test_progs.h"
#include "cgroup_helpers.h"
#include "network_helpers.h"
#include "setget_sockopt.skel.... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/tcpbpf_user' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
#include <network_helpers.h>
#include "test_tcpbpf.h"
#include "test_tcpbpf_kern.skel.h"
#define LO_ADDR6 "::1"
#define CG_NAME "/tcpbpf-user-test"
static void verify_result(struct tcpbpf_globals *result)
{
__u32 expected_events = ((1 << BPF_SOCK_OPS_... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/bpf_cookie' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2021 Facebook */
#define _GNU_SOURCE
#include <pthread.h>
#include <sched.h>
#include <sys/syscall.h>
#include <sys/mman.h>
#include <unistd.h>
#include <linux/compiler.h>
#include <test_progs.h>
#include <network_helpers.h>
#include <bpf/btf.h>
#include "test_b... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/endian' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2020 Facebook */
#include <test_progs.h>
#include "test_endian.skel.h"
static int duration;
#define IN16 0x1234
#define IN32 0x12345678U
#define IN64 0x123456789abcdef0ULL
#define OUT16 0x3412
#define OUT32 0x78563412U
#define OUT64 0xf0debc9a78563412ULL
vo... | |
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/prog_tests/lwt_helpers' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz. | ```c
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __LWT_HELPERS_H
#define __LWT_HELPERS_H
#include <time.h>
#include <net/if.h>
#include <linux/icmp.h>
#include "test_progs.h"
#define log_err(MSG, ...) \
fprintf(stderr, "(%s:%d: errno: %s) " MSG "\n", \
__FILE__, __LINE__, strerror(errno), ##__VA_ARGS__)
#def... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/atomic_bounds' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
#include "atomic_bounds.skel.h"
void test_atomic_bounds(void)
{
struct atomic_bounds *skel;
__u32 duration = 0;
skel = atomic_bounds__open_and_load();
if (CHECK(!skel, "skel_load", "couldn't load program\n"))
return;
atomic_bounds__destroy(ske... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/xdp_info' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <linux/if_link.h>
#include <test_progs.h>
#define IFINDEX_LO 1
void serial_test_xdp_info(void)
{
__u32 len = sizeof(struct bpf_prog_info), duration = 0, prog_id;
const char *file = "./xdp_dummy.bpf.o";
LIBBPF_OPTS(bpf_xdp_query_opts, opts);
struct bpf_prog_info in... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/task_fd_query_rawtp' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
void test_task_fd_query_rawtp(void)
{
const char *file = "./test_get_stack_rawtp.bpf.o";
__u64 probe_offset, probe_addr;
__u32 len, prog_id, fd_type;
struct bpf_object *obj;
int efd, err, prog_fd;
__u32 duration = 0;
char buf[256];
err = bpf_pro... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/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 <test_progs.h>
#include "test_map_lookup_percpu_elem.skel.h"
void test_map_lookup_percpu_elem(void)
{
struct test_map_lookup_percpu_elem *skel;
__u64 key = 0, sum;
int ret, i, nr_cpus = libbpf_num_possible_cpus();
__u64 *buf;
b... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/cgroup_v1v2' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
#include "connect4_dropper.skel.h"
#include "cgroup_helpers.h"
#include "network_helpers.h"
static int run_test(int cgroup_fd, int server_fd, bool classid)
{
struct connect4_dropper *skel;
int fd, err = 0, port;
skel = connect4_dropper__open_and_l... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/perf_branches' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#define _GNU_SOURCE
#include <pthread.h>
#include <sched.h>
#include <sys/socket.h>
#include <test_progs.h>
#include "bpf/libbpf_internal.h"
#include "test_perf_branches.skel.h"
static void check_good_sample(struct test_perf_branches *skel)
{
int written_global = skel->bss->wr... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/cgroup_attach_autodetach' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
#include "cgroup_helpers.h"
#define PING_CMD "ping -q -c1 -w1 127.0.0.1 > /dev/null"
static char bpf_log_buf[BPF_LOG_BUF_SIZE];
static int prog_load(void)
{
struct bpf_insn prog[] = {
BPF_MOV64_IMM(BPF_REG_0, 1), /* r0 = 1 */
BPF_EXIT_INSN(),
}... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/missed' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
#include "missed_kprobe.skel.h"
#include "missed_kprobe_recursion.skel.h"
#include "missed_tp_recursion.skel.h"
/*
* Putting kprobe on bpf_fentry_test1 that calls bpf_kfunc_common_test
* kfunc, which has also kprobe on. The latter won't get triggered d... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/get_branch_snapshot' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2021 Facebook */
#include <test_progs.h>
#include "get_branch_snapshot.skel.h"
static int *pfd_array;
static int cpu_cnt;
static bool is_hypervisor(void)
{
char *line = NULL;
bool ret = false;
size_t len;
FILE *fp;
fp = fopen("/proc/cpuinfo", "r");
if (... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/local_kptr_stash' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */
#include <test_progs.h>
#include <network_helpers.h>
#include "local_kptr_stash.skel.h"
#include "local_kptr_stash_fail.skel.h"
static void test_local_kptr_stash_simple(void)
{
LIBBPF_OPTS(bpf_test_run_opts, opts,
... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/core_reloc_raw' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Test cases that can't load programs using libbpf and need direct
* BPF syscall access
*/
#include <sys/syscall.h>
#include <bpf/libbpf.h>
#include <bpf/btf.h>
#include "test_progs.h"
#include "test_btf.h"
#include "bpf/libbpf_internal.h"
static char log[16 * 1024];
/* ... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_global_funcs' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2020 Facebook */
#include <test_progs.h>
#include "test_global_func1.skel.h"
#include "test_global_func2.skel.h"
#include "test_global_func3.skel.h"
#include "test_global_func4.skel.h"
#include "test_global_func5.skel.h"
#include "test_global_func6.skel.h"
#incl... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/cgroup_link' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
#include "cgroup_helpers.h"
#include "testing_helpers.h"
#include "test_cgroup_link.skel.h"
static __u32 duration = 0;
#define PING_CMD "ping -q -c1 -w1 127.0.0.1 > /dev/null"
static struct test_cgroup_link *skel = NULL;
int ping_and_check(int exp_cal... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/sock_addr' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <sys/un.h>
#include "test_progs.h"
#include "sock_addr_kern.skel.h"
#include "bind4_prog.skel.h"
#include "bind6_prog.skel.h"
#include "connect_unix_prog.skel.h"
#include "connect4_prog.skel.h"
#include "connect6_prog.skel.h"
#include "sendmsg4_prog.skel.h"
#include "... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/check_mtu' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2020 Jesper Dangaard Brouer */
#include <linux/if_link.h> /* before test_progs.h, avoid bpf_util.h redefines */
#include <test_progs.h>
#include "test_check_mtu.skel.h"
#include "network_helpers.h"
#include <stdlib.h>
#include <inttypes.h>
#define IFINDEX_LO ... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/core_read_macros' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2020 Facebook */
#include <test_progs.h>
struct callback_head {
struct callback_head *next;
void (*func)(struct callback_head *head);
};
/* ___shuffled flavor is just an illusion for BPF code, it doesn't really
* exist and user-space needs to provide data ... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/kfunc_call' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2021 Facebook */
#include <test_progs.h>
#include <network_helpers.h>
#include "kfunc_call_fail.skel.h"
#include "kfunc_call_test.skel.h"
#include "kfunc_call_test.lskel.h"
#include "kfunc_call_test_subprog.skel.h"
#include "kfunc_call_test_subprog.lskel.h"
#inc... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_ldsx_insn' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2023 Meta Platforms, Inc. and affiliates.*/
#include <test_progs.h>
#include <network_helpers.h>
#include "test_ldsx_insn.skel.h"
static void test_map_val_and_probed_memory(void)
{
struct test_ldsx_insn *skel;
int err;
skel = test_ldsx_insn__open();
if (!... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/prog_array_init' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2021 Hengqi Chen */
#include <test_progs.h>
#include "test_prog_array_init.skel.h"
void test_prog_array_init(void)
{
struct test_prog_array_init *skel;
int err;
skel = test_prog_array_init__open();
if (!ASSERT_OK_PTR(skel, "could not open BPF object"))... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/recursive_attach' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2023 Red Hat, Inc. */
#include <test_progs.h>
#include "fentry_recursive.skel.h"
#include "fentry_recursive_target.skel.h"
#include <bpf/btf.h>
#include "bpf/libbpf_internal.h"
/* Test recursive attachment of tracing progs with more than one nesting level
* is... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/cgroup_get_current_cgroup_id' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <sys/stat.h>
#include <sys/sysmacros.h>
#include "test_progs.h"
#include "cgroup_helpers.h"
#include "get_cgroup_id_kern.skel.h"
#define TEST_CGROUP "/test-bpf-get-cgroup-id/"
void test_cgroup_get_current_cgroup_id(void)
{
struct get_cgroup_id_kern *skel;
const str... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_local_storage' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2020 Google LLC.
*/
#include <asm-generic/errno-base.h>
#include <sys/stat.h>
#include <test_progs.h>
#include <linux/limits.h>
#include "local_storage.skel.h"
#include "network_helpers.h"
#include "task_local_storage_helpers.h"
#define TEST_STORAGE_VALU... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/kfree_skb' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#define _GNU_SOURCE
#include <test_progs.h>
#include <network_helpers.h>
#include "kfree_skb.skel.h"
struct meta {
int ifindex;
__u32 cb32_0;
__u8 cb8_0;
};
static union {
__u32 cb32[5];
__u8 cb8[20];
} cb = {
.cb32[0] = 0x81828384,
};
static void on_sample(void *ctx, i... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/cgroup_getset_retval' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright 2021 Google LLC.
*/
#include <test_progs.h>
#include <cgroup_helpers.h>
#include <network_helpers.h>
#include "cgroup_getset_retval_setsockopt.skel.h"
#include "cgroup_getset_retval_getsockopt.skel.h"
#include "cgroup_getset_retval_hooks.skel.h"
#define... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/fs_kfuncs' 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 <stdlib.h>
#include <sys/types.h>
#include <sys/xattr.h>
#include <linux/fsverity.h>
#include <unistd.h>
#include <test_progs.h>
#include "test_get_xattr.skel.h"
#include "test_set_remove_xattr.skel.h"
#incl... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_sysctl' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2019 Facebook
#include "test_progs.h"
#include "cgroup_helpers.h"
#define CG_PATH "/foo"
#define MAX_INSNS 512
#define FIXUP_SYSCTL_VALUE 0
char bpf_log_buf[BPF_LOG_BUF_SIZE];
struct sysctl_test {
const char *descr;
size_t fixup_value_insn;
struct bpf_... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/lsm_cgroup' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <sys/types.h>
#include <sys/socket.h>
#include <test_progs.h>
#include <bpf/btf.h>
#include "lsm_cgroup.skel.h"
#include "lsm_cgroup_nonvoid.skel.h"
#include "cgroup_helpers.h"
#include "network_helpers.h"
static struct btf *btf;
static __u32 query_prog_cnt(int cgro... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/test_bpf_smc' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
#include <linux/genetlink.h>
#include "network_helpers.h"
#include "bpf_smc.skel.h"
#ifndef IPPROTO_SMC
#define IPPROTO_SMC 256
#endif
#define CLIENT_IP "127.0.0.1"
#define SERVER_IP "127.0.1.0"
#define SERVER_IP_VIA_RISK_PATH "127.0.2.0"
#define S... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/vmlinux' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2020 Facebook */
#include <test_progs.h>
#include <time.h>
#include "test_vmlinux.skel.h"
#define MY_TV_NSEC 1337
static void nsleep()
{
struct timespec ts = { .tv_nsec = MY_TV_NSEC };
(void)syscall(__NR_nanosleep, &ts, NULL);
}
void test_vmlinux(void)
{
... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/cgrp_kfunc' 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. */
#define _GNU_SOURCE
#include <cgroup_helpers.h>
#include <test_progs.h>
#include <sched.h>
#include <sys/wait.h>
#include "cgrp_kfunc_failure.skel.h"
#include "cgrp_kfunc_success.skel.h"
static struct cgrp_kfunc_su... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/autoload' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2020 Facebook */
#include <test_progs.h>
#include <time.h>
#include "test_autoload.skel.h"
void test_autoload(void)
{
int duration = 0, err;
struct test_autoload* skel;
skel = test_autoload__open_and_load();
/* prog3 should be broken */
if (CHECK(skel, "... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/timer_crash' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
#include "timer_crash.skel.h"
enum {
MODE_ARRAY,
MODE_HASH,
};
static void test_timer_crash_mode(int mode)
{
struct timer_crash *skel;
skel = timer_crash__open_and_load();
if (!skel && errno == EOPNOTSUPP) {
test__skip();
return;
}
if (!ASSE... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/lwt_seg6local' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0-only
/* Connects 6 network namespaces through veths.
* Each NS may have different IPv6 global scope addresses :
*
* NS1 NS2 NS3 NS4 NS5 NS6
* lo veth1 <-> veth2 veth3 <-> veth4 veth5 <-> veth6 lo v... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/sock_post_bind' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <linux/bpf.h>
#include <test_progs.h>
#include "cgroup_helpers.h"
#define TEST_NS "sock_post_bind"
static char bpf_log_buf[4096];
static struct sock_post_bind_test {
const char *descr;
/* BPF prog properties */
const struct bpf_insn insns[64];
enum bpf_attach_... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/bpf_gotox' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
#include <linux/if_ether.h>
#include <linux/in.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
#include <linux/in6.h>
#include <linux/udp.h>
#include <linux/tcp.h>
#include <sys/syscall.h>
#include <bpf/bpf.h>
#include "bpf_gotox.skel.h"
static void... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/global_data_init' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
void test_global_data_init(void)
{
const char *file = "./test_global_data.bpf.o";
int err = -ENOMEM, map_fd, zero = 0;
__u8 *buff = NULL, *newval = NULL;
struct bpf_object *obj;
struct bpf_map *map;
__u32 duration = 0;
size_t sz;
obj = bp... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/deny_namespace' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#define _GNU_SOURCE
#include <test_progs.h>
#include "test_deny_namespace.skel.h"
#include <sched.h>
#include "cap_helpers.h"
#include <stdio.h>
static int wait_for_pid(pid_t pid)
{
int status, ret;
again:
ret = waitpid(pid, &status, 0);
if (ret == -1) {
if (errno == EINT... | |
Linux kernel'inin 'tools/testing/selftests/bpf/prog_tests/bpf_nf' alt sistemi için gerekli C kaynak kodunu implemente et. | ```c
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
#include <network_helpers.h>
#include <linux/netfilter/nf_conntrack_common.h>
#include "test_bpf_nf.skel.h"
#include "test_bpf_nf_fail.skel.h"
static char log_buf[1024 * 1024];
struct {
const char *prog_name;
const char *err_msg;
} test_bpf_nf_fail_te... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.