Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for passing properties to NewSystemd #344

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions cgroup2/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ func dashesToPath(in string) string {
return path
}

func NewSystemd(slice, group string, pid int, resources *Resources) (*Manager, error) {
func NewSystemd(slice, group string, pid int, resources *Resources, properties []systemdDbus.Property) (*Manager, error) {
if slice == "" {
slice = defaultSlice
}
Expand All @@ -842,12 +842,14 @@ func NewSystemd(slice, group string, pid int, resources *Resources) (*Manager, e
}
defer conn.Close()

properties := []systemdDbus.Property{
systemdDbus.PropDescription("cgroup " + group),
newSystemdProperty("DefaultDependencies", false),
newSystemdProperty("MemoryAccounting", true),
newSystemdProperty("CPUAccounting", true),
newSystemdProperty("IOAccounting", true),
if len(properties) == 0 {
properties = []systemdDbus.Property{
systemdDbus.PropDescription("cgroup " + group),
newSystemdProperty("DefaultDependencies", false),
newSystemdProperty("MemoryAccounting", true),
newSystemdProperty("CPUAccounting", true),
newSystemdProperty("IOAccounting", true),
}
}

// if we create a slice, the parent is defined via a Wants=
Expand Down
Loading