brintos

brintos / linux-shallow public Read only

0
0
Text · 679 B · 962f346 Raw
31 lines · c
1// SPDX-License-Identifier: GPL-2.02/* Copyright (c) 2022 Meta Platforms, Inc. and affiliates. */3 4#include "vmlinux.h"5#include <bpf/bpf_helpers.h>6#include <bpf/usdt.bpf.h>7 8/* this file is linked together with test_usdt.c to validate that usdt.bpf.h9 * can be included in multiple .bpf.c files forming single final BPF object10 * file11 */12 13extern int my_pid;14 15int usdt_100_called;16int usdt_100_sum;17 18SEC("usdt//proc/self/exe:test:usdt_100")19int BPF_USDT(usdt_100, int x)20{21	if (my_pid != (bpf_get_current_pid_tgid() >> 32))22		return 0;23 24	__sync_fetch_and_add(&usdt_100_called, 1);25	__sync_fetch_and_add(&usdt_100_sum, x);26 27	return 0;28}29 30char _license[] SEC("license") = "GPL";31