brintos

brintos / linux-shallow public Read only

0
0
Text · 932 B · 969306c Raw
35 lines · c
1// SPDX-License-Identifier: GPL-2.02/* Copyright (c) 2021 Facebook */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 null_data_vprintk_ret = 0;12int trace_vprintk_ret = 0;13int trace_vprintk_ran = 0;14 15SEC("fentry/" SYS_PREFIX "sys_nanosleep")16int sys_enter(void *ctx)17{18	static const char one[] = "1";19	static const char three[] = "3";20	static const char five[] = "5";21	static const char seven[] = "7";22	static const char nine[] = "9";23	static const char f[] = "%pS\n";24 25	/* runner doesn't search for \t, just ensure it compiles */26	bpf_printk("\t");27 28	trace_vprintk_ret = __bpf_vprintk("%s,%d,%s,%d,%s,%d,%s,%d,%s,%d %d\n",29		one, 2, three, 4, five, 6, seven, 8, nine, 10, ++trace_vprintk_ran);30 31	/* non-NULL fmt w/ NULL data should result in error */32	null_data_vprintk_ret = bpf_trace_vprintk(f, sizeof(f), NULL, 0);33	return 0;34}35