Files
nomad/drivers/shared/executor/procstats/list_linux.go
Seth Hoenig e3c8700ded deps: upgrade to go-set/v2 (#18638)
No functional changes, just cleaning up deprecated usages that are
removed in v2 and replace one call of .Slice with .ForEach to avoid
making the intermediate copy.
2023-10-05 11:56:17 -05:00

26 lines
448 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
//go:build linux
package procstats
import (
"github.com/hashicorp/go-set/v2"
"github.com/hashicorp/nomad/client/lib/cgroupslib"
)
type Cgrouper interface {
StatsCgroup() string
}
func List(cg Cgrouper) *set.Set[ProcessID] {
cgroup := cg.StatsCgroup()
ed := cgroupslib.OpenPath(cgroup)
s, err := ed.PIDs()
if err != nil {
return set.New[ProcessID](0)
}
return s
}