1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2018 Facebook
5 #include "bpf_helpers.h"
8 __uint(type
, BPF_MAP_TYPE_ARRAY
);
9 __uint(max_entries
, 1);
12 } cg_ids
SEC(".maps");
15 __uint(type
, BPF_MAP_TYPE_ARRAY
);
16 __uint(max_entries
, 1);
19 } pidmap
SEC(".maps");
21 SEC("tracepoint/syscalls/sys_enter_nanosleep")
24 __u32 pid
= bpf_get_current_pid_tgid();
25 __u32 key
= 0, *expected_pid
;
28 expected_pid
= bpf_map_lookup_elem(&pidmap
, &key
);
29 if (!expected_pid
|| *expected_pid
!= pid
)
32 val
= bpf_map_lookup_elem(&cg_ids
, &key
);
34 *val
= bpf_get_current_cgroup_id();
39 char _license
[] SEC("license") = "GPL";
40 __u32 _version
SEC("version") = 1; /* ignored by tracepoints, required by libbpf.a */