open-nomad/client/fingerprint/cgroup_linux.go

25 lines
537 B
Go
Raw Normal View History

2016-01-27 06:22:25 +00:00
// +build linux
package fingerprint
import (
"github.com/opencontainers/runc/libcontainer/cgroups"
)
// FindCgroupMountpointDir is used to find the cgroup mount point on a Linux
// system.
2016-01-27 06:22:25 +00:00
func FindCgroupMountpointDir() (string, error) {
mount, err := cgroups.FindCgroupMountpointDir()
if err != nil {
switch e := err.(type) {
case *cgroups.NotFoundError:
// It's okay if the mount point is not discovered
return "", nil
default:
// All other errors are passed back as is
return "", e
}
}
return mount, nil
}