22 lines · c
1// SPDX-License-Identifier: GPL-2.02// Copyright (c) 2018 Facebook3 4#include <linux/bpf.h>5#include <bpf/bpf_helpers.h>6 7__u64 cg_id;8__u64 expected_pid;9 10SEC("tracepoint/syscalls/sys_enter_nanosleep")11int trace(void *ctx)12{13 __u32 pid = bpf_get_current_pid_tgid();14 15 if (expected_pid == pid)16 cg_id = bpf_get_current_cgroup_id();17 18 return 0;19}20 21char _license[] SEC("license") = "GPL";22