brintos

brintos / linux-shallow public Read only

0
0
Text · 589 B · 106dc75 Raw
33 lines · c
1// SPDX-License-Identifier: GPL-2.02/* Copyright (c) 2021 Facebook */3#include "vmlinux.h"4#include <bpf/bpf_helpers.h>5#include <bpf/bpf_tracing.h>6#include "bpf_misc.h"7 8char LICENSE[] SEC("license") = "GPL";9 10int pid = 0;11int fentry_cnt = 0;12int fexit_cnt = 0;13 14SEC("fentry/" SYS_PREFIX "sys_nanosleep")15int nanosleep_fentry(void *ctx)16{17	if (bpf_get_current_pid_tgid() >> 32 != pid)18		return 0;19 20	fentry_cnt++;21	return 0;22}23 24SEC("fexit/" SYS_PREFIX "sys_nanosleep")25int nanosleep_fexit(void *ctx)26{27	if (bpf_get_current_pid_tgid() >> 32 != pid)28		return 0;29 30	fexit_cnt++;31	return 0;32}33