Linux Audio

Check our new training course

In-person Linux kernel drivers training

Jun 16-20, 2025
Register
Loading...
v6.13.7
 1// SPDX-License-Identifier: GPL-2.0
 2// Copyright (c) 2020, Oracle and/or its affiliates.
 3
 4#include "vmlinux.h"
 5#include <bpf/bpf_helpers.h>
 6#include <bpf/bpf_tracing.h>
 7#include "bpf_misc.h"
 8
 9char _license[] SEC("license") = "GPL";
10
11int trace_printk_ret = 0;
12int trace_printk_ran = 0;
13
14const char fmt[] = "Testing,testing %d\n";
15
16SEC("fentry/" SYS_PREFIX "sys_nanosleep")
17int sys_enter(void *ctx)
18{
19	trace_printk_ret = bpf_trace_printk(fmt, sizeof(fmt),
20					    ++trace_printk_ran);
21	return 0;
22}
v5.14.15
 1// SPDX-License-Identifier: GPL-2.0
 2// Copyright (c) 2020, Oracle and/or its affiliates.
 3
 4#include "vmlinux.h"
 5#include <bpf/bpf_helpers.h>
 6#include <bpf/bpf_tracing.h>
 
 7
 8char _license[] SEC("license") = "GPL";
 9
10int trace_printk_ret = 0;
11int trace_printk_ran = 0;
12
13const char fmt[] = "Testing,testing %d\n";
14
15SEC("fentry/__x64_sys_nanosleep")
16int sys_enter(void *ctx)
17{
18	trace_printk_ret = bpf_trace_printk(fmt, sizeof(fmt),
19					    ++trace_printk_ran);
20	return 0;
21}