mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
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.
26 lines
448 B
Go
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
|
|
}
|