MCPcopy Create free account
hub / github.com/containerd/cgroups / dashesToPath

Function dashesToPath

cgroup2/manager.go:927–942  ·  view source on GitHub ↗

dashesToPath converts a slice name with dashes to it's corresponding systemd filesystem path.

(in string)

Source from the content-addressed store, hash-verified

925
926// dashesToPath converts a slice name with dashes to it's corresponding systemd filesystem path.
927func dashesToPath(in string) string {
928 path := ""
929 if strings.HasSuffix(in, ".slice") && strings.Contains(in, "-") {
930 parts := strings.Split(in, "-")
931 for i := range parts {
932 s := strings.Join(parts[0:i+1], "-")
933 if !strings.HasSuffix(s, ".slice") {
934 s += ".slice"
935 }
936 path = filepath.Join(path, s)
937 }
938 } else {
939 path = filepath.Join(path, in)
940 }
941 return path
942}
943
944func NewSystemd(slice, group string, pid int, resources *Resources) (*Manager, error) {
945 if slice == "" {

Callers 1

getSystemdFullPathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…