merge branch 'pr-2495'
Kir Kolyshkin (1): cgroups/fs/path: optimize LGTMs: @mrunalp @cyphar Closes #2495
This commit is contained in:
commit
819fcc687e
|
@ -351,14 +351,14 @@ func getCgroupData(c *configs.Cgroup, pid int) (*cgroupData, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (raw *cgroupData) path(subsystem string) (string, error) {
|
func (raw *cgroupData) path(subsystem string) (string, error) {
|
||||||
|
// If the cgroup name/path is absolute do not look relative to the cgroup of the init process.
|
||||||
|
if filepath.IsAbs(raw.innerPath) {
|
||||||
mnt, err := cgroups.FindCgroupMountpoint(raw.root, subsystem)
|
mnt, err := cgroups.FindCgroupMountpoint(raw.root, subsystem)
|
||||||
// If we didn't mount the subsystem, there is no point we make the path.
|
// If we didn't mount the subsystem, there is no point we make the path.
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the cgroup name/path is absolute do not look relative to the cgroup of the init process.
|
|
||||||
if filepath.IsAbs(raw.innerPath) {
|
|
||||||
// Sometimes subsystems can be mounted together as 'cpu,cpuacct'.
|
// Sometimes subsystems can be mounted together as 'cpu,cpuacct'.
|
||||||
return filepath.Join(raw.root, filepath.Base(mnt), raw.innerPath), nil
|
return filepath.Join(raw.root, filepath.Base(mnt), raw.innerPath), nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue