xref: /kernel/linux/linux-5.10/tools/testing/selftests/bpf/progs/trace_printk.c
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /kernel/linux/linux-5.10/tools/testing/selftests/bpf/progs/
18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci// Copyright (c) 2020, Oracle and/or its affiliates.
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#include "vmlinux.h"
58c2ecf20Sopenharmony_ci#include <bpf/bpf_helpers.h>
68c2ecf20Sopenharmony_ci#include <bpf/bpf_tracing.h>
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_cichar _license[] SEC("license") = "GPL";
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciint trace_printk_ret = 0;
118c2ecf20Sopenharmony_ciint trace_printk_ran = 0;
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciSEC("tp/raw_syscalls/sys_enter")
148c2ecf20Sopenharmony_ciint sys_enter(void *ctx)
158c2ecf20Sopenharmony_ci{
168c2ecf20Sopenharmony_ci	static const char fmt[] = "testing,testing %d\n";
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci	trace_printk_ret = bpf_trace_printk(fmt, sizeof(fmt),
198c2ecf20Sopenharmony_ci					    ++trace_printk_ran);
208c2ecf20Sopenharmony_ci	return 0;
218c2ecf20Sopenharmony_ci}
22

Indexes created Thu Nov 07 10:32:03 CST 2024