Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 // Copyright (c) 2020, Oracle and/or its affiliates.
0003 
0004 #include "vmlinux.h"
0005 #include <bpf/bpf_helpers.h>
0006 #include <bpf/bpf_tracing.h>
0007 #include "bpf_misc.h"
0008 
0009 char _license[] SEC("license") = "GPL";
0010 
0011 int trace_printk_ret = 0;
0012 int trace_printk_ran = 0;
0013 
0014 const char fmt[] = "Testing,testing %d\n";
0015 
0016 SEC("fentry/" SYS_PREFIX "sys_nanosleep")
0017 int sys_enter(void *ctx)
0018 {
0019     trace_printk_ret = bpf_trace_printk(fmt, sizeof(fmt),
0020                         ++trace_printk_ran);
0021     return 0;
0022 }