xref: /linux/samples/bpf/test_overhead_tp.bpf.c (revision d6fd48ef)
1 /* Copyright (c) 2016 Facebook
2  *
3  * This program is free software; you can redistribute it and/or
4  * modify it under the terms of version 2 of the GNU General Public
5  * License as published by the Free Software Foundation.
6  */
7 #include "vmlinux.h"
8 #include <bpf/bpf_helpers.h>
9 
10 /* from /sys/kernel/debug/tracing/events/task/task_rename/format */
11 struct task_rename {
12 	__u64 pad;
13 	__u32 pid;
14 	char oldcomm[TASK_COMM_LEN];
15 	char newcomm[TASK_COMM_LEN];
16 	__u16 oom_score_adj;
17 };
18 SEC("tracepoint/task/task_rename")
19 int prog(struct task_rename *ctx)
20 {
21 	return 0;
22 }
23 
24 /* from /sys/kernel/debug/tracing/events/fib/fib_table_lookup/format */
25 struct fib_table_lookup {
26 	__u64 pad;
27 	__u32 tb_id;
28 	int err;
29 	int oif;
30 	int iif;
31 	__u8 proto;
32 	__u8 tos;
33 	__u8 scope;
34 	__u8 flags;
35 	__u8 src[4];
36 	__u8 dst[4];
37 	__u8 gw4[4];
38 	__u8 gw6[16];
39 	__u16 sport;
40 	__u16 dport;
41 	char name[16];
42 };
43 SEC("tracepoint/fib/fib_table_lookup")
44 int prog2(struct fib_table_lookup *ctx)
45 {
46 	return 0;
47 }
48 char _license[] SEC("license") = "GPL";
49