Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libcontainer] GetOwnCgroup is currently not supported for cgroup v2 #2468

Open
h-vetinari opened this issue Jun 12, 2020 · 1 comment
Open

Comments

@h-vetinari
Copy link

Opening an issue mentioned by @giuseppe here. Feel free to edit this OP.

@AkihiroSuda AkihiroSuda changed the title GetOwnCgroup is currently not supported for cgroup v2 [libcontainer] GetOwnCgroup is currently not supported for cgroup v2 Jun 15, 2020
@AkihiroSuda AkihiroSuda added the area/go-api libcontainer Go API label Jun 17, 2020
@kolyshkin
Copy link
Contributor

The implementation seem to be something like

func GetOwnCgroupV2() (string, error) {
  if !IsCgroup2UnifiedMode() {
    return errors.New("not implemented for cgroup v1")
  }
  out, err := ioutils.ReadFile("/proc/self/cgroup")
  if err != nil {
    return "", err
  }
  return strings.TrimPrefix("0::", out), nil
}

Or did you have something different in mind @giuseppe? Also, what is the use case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants