2

The eBPF helper functions define bpf_get_current_cgroup_id for eBPF programs, which does the obvious thing

u64 bpf_get_current_cgroup_id(void)

        Return A 64-bit integer containing the current cgroup id
               based on the cgroup within which the current task
               is running.

However I can't find an equivalent system call (something similar to getpid) that I can use in a regular old C program

Am I just completely missing the relevant function? Or does userspace need to do something different to get the cgroup ID for the current task?

user547386
  • 21
  • 2
  • I'm not sure that information is exposed to userspace. What are you trying to do with those IDs? – pchaigno Nov 02 '22 at 09:12
  • The idea was to write a bpf program which could be configured to only run when called from processes in a certain cgroup. I've since found a better way to accomplish that, however. – user547386 Nov 11 '22 at 18:59

0 Answers0