#include <linux/ptrace.h>
#include <linux/version.h>
#include <uapi/linux/bpf.h>
#include "bpf_helpers.h"

struct bpf_map_def SEC("maps") my_map = {
	.type = BPF_MAP_TYPE_PERF_EVENT_ARRAY,
	.key_size = sizeof(int),
	.value_size = sizeof(u32),
	.max_entries = 2,
};

SEC("kprobe/sys_write")
int bpf_prog1(struct pt_regs *ctx)
{
	struct S {
		u64 pid;
		u64 cookie;
	} data;

	data.pid = bpf_get_current_pid_tgid();
	data.cookie = 0x12345678;

	bpf_perf_event_output(ctx, &my_map, 0, &data, sizeof(data));

	return 0;
}

char _license[] SEC("license") = "GPL";
u32 _version SEC("version") = LINUX_VERSION_CODE;
d='cgit'><table id='header'>
<tr>
<td class='logo' rowspan='2'><a href='/cgit.cgi/'><img src='/cgit.png' alt='cgit logo'/></a></td>
<td class='main'><a href='/cgit.cgi/'>index</a> : <a href='/cgit.cgi/linux/net-next.git/'>net-next.git</a></td><td class='form'><form method='get'>
<input type='hidden' name='id' value='f7d6040aa45df6ffd9e891114125dc919f18b96b'/><select name='h' onchange='this.form.submit();'>
<option value='emaclite-cleanup'>emaclite-cleanup</option>
<option value='master' selected='selected'>master</option>
<option value='nds-private-remove'>nds-private-remove</option>
<option value='packet-loop-back'>packet-loop-back</option>
<option value='packet-rx-pump-back'>packet-rx-pump-back</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>net-next plumbings</td><td class='sub right'>Tobias Klauser</td></tr></table>
<table class='tabs'><tr><td>
<a href='/cgit.cgi/linux/net-next.git/'>summary</a><a href='/cgit.cgi/linux/net-next.git/refs/?id=f7d6040aa45df6ffd9e891114125dc919f18b96b'>refs</a><a class='active' href='/cgit.cgi/linux/net-next.git/log/include/dt-bindings/reset/qcom,gcc-ipq806x.h'>log</a><a href='/cgit.cgi/linux/net-next.git/tree/include/dt-bindings/reset/qcom,gcc-ipq806x.h?id=f7d6040aa45df6ffd9e891114125dc919f18b96b'>tree</a><a href='/cgit.cgi/linux/net-next.git/commit/include/dt-bindings/reset/qcom,gcc-ipq806x.h?id=f7d6040aa45df6ffd9e891114125dc919f18b96b'>commit</a><a href='/cgit.cgi/linux/net-next.git/diff/include/dt-bindings/reset/qcom,gcc-ipq806x.h?id=f7d6040aa45df6ffd9e891114125dc919f18b96b'>diff</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/linux/net-next.git/log/include/dt-bindings/reset/qcom,gcc-ipq806x.h'>
<input type='hidden' name='id' value='f7d6040aa45df6ffd9e891114125dc919f18b96b'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/log/?id=f7d6040aa45df6ffd9e891114125dc919f18b96b'>root</a>/<a href='/cgit.cgi/linux/net-next.git/log/include?id=f7d6040aa45df6ffd9e891114125dc919f18b96b'>include</a>/<a href='/cgit.cgi/linux/net-next.git/log/include/dt-bindings?id=f7d6040aa45df6ffd9e891114125dc919f18b96b'>dt-bindings</a>/<a href='/cgit.cgi/linux/net-next.git/log/include/dt-bindings/reset?id=f7d6040aa45df6ffd9e891114125dc919f18b96b'>reset</a>/<a href='/cgit.cgi/linux/net-next.git/log/include/dt-bindings/reset/qcom,gcc-ipq806x.h?id=f7d6040aa45df6ffd9e891114125dc919f18b96b'>qcom,gcc-ipq806x.h</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th class='left'>Age</th><th class='left'>Commit message (<a href='/cgit.cgi/linux/net-next.git/log/include/dt-bindings/reset/qcom,gcc-ipq806x.h?id=f7d6040aa45df6ffd9e891114125dc919f18b96b&amp;showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr>