1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2018 Facebook
3 
4 #include <linux/bpf.h>
5 #include <bpf/bpf_helpers.h>
6 
7 __u64 cg_id;
8 __u64 expected_pid;
9 
10 SEC("tracepoint/syscalls/sys_enter_nanosleep")
trace(void * ctx)11 int 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 
21 char _license[] SEC("license") = "GPL";
22