1// SPDX-License-Identifier: GPL-2.0
2/* Copyright (c) 2020 Facebook */
3
4#include "vmlinux.h"
5#include <bpf/bpf_helpers.h>
6#include <bpf/bpf_tracing.h>
7
8__u32 count = 0;
9__u32 on_cpu = 0xffffffff;
10
11SEC("raw_tp/task_rename")
12int BPF_PROG(rename, struct task_struct *task, char *comm)
13{
14
15 count++;
16 if ((__u64) task == 0x1234ULL && (__u64) comm == 0x5678ULL) {
17 on_cpu = bpf_get_smp_processor_id();
18 return (long)task + (long)comm;
19 }
20
21 return 0;
22}
23
24char _license[] SEC("license") = "GPL";
25

source code of linux/tools/testing/selftests/bpf/progs/test_raw_tp_test_run.c