Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Linux/tools/testing/selftests/bpf/progs/   (Open Source Betriebssystem Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 1 kB image not shown  

Quelle  test_core_read_macros.c   Sprache: C

 
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2020 Facebook

#include "vmlinux.h"
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_core_read.h>

char _license[] SEC("license") = "GPL";

/* shuffled layout for relocatable (CO-RE) reads */
struct callback_head___shuffled {
 void (*func)(struct callback_head___shuffled *head);
 struct callback_head___shuffled *next;
};

struct callback_head k_probe_in = {};
struct callback_head___shuffled k_core_in = {};

struct callback_head *u_probe_in = 0;
struct callback_head___shuffled *u_core_in = 0;

long k_probe_out = 0;
long u_probe_out = 0;

long k_core_out = 0;
long u_core_out = 0;

int my_pid = 0;

SEC("raw_tracepoint/sys_enter")
int handler(void *ctx)
{
 int pid = bpf_get_current_pid_tgid() >> 32;

 if (my_pid != pid)
  return 0;

 /* next pointers for kernel address space have to be initialized from
 * BPF side, user-space mmaped addresses are still user-space addresses
 */

 k_probe_in.next = &k_probe_in;
 __builtin_preserve_access_index(({k_core_in.next = &k_core_in;}));

 k_probe_out = (long)BPF_PROBE_READ(&k_probe_in, next, next, func);
 k_core_out = (long)BPF_CORE_READ(&k_core_in, next, next, func);
 u_probe_out = (long)BPF_PROBE_READ_USER(u_probe_in, next, next, func);
 u_core_out = (long)BPF_CORE_READ_USER(u_core_in, next, next, func);

 return 0;
}

Messung V0.5
C=95 H=93 G=93

¤ Dauer der Verarbeitung: 0.2 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.