Skip to content

Commit

Permalink
Merge pull request #209 from imain/publicjoin
Browse files Browse the repository at this point in the history
Make joinDevices public.
  • Loading branch information
vmarmol committed Oct 16, 2014
2 parents 55f5554 + d67a27e commit 0f49d1f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cgroups/fs/apply_raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,19 @@ func Apply(c *cgroups.Cgroup, pid int) (cgroups.ActiveCgroup, error) {
return d, nil
}

// Symmetrical public function to update device based cgroups. Also available
// in the systemd implementation.
func ApplyDevices(c *cgroups.Cgroup, pid int) error {
d, err := getCgroupData(c, pid)
if err != nil {
return err
}

devices := subsystems["devices"]

return devices.Set(d)
}

func Cleanup(c *cgroups.Cgroup) error {
d, err := getCgroupData(c, 0)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions cgroups/systemd/apply_nosystemd.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ func GetPids(c *cgroups.Cgroup) ([]int, error) {
return nil, fmt.Errorf("Systemd not supported")
}

func ApplyDevices(c *cgroups.Cgroup, pid int) error {
return fmt.Errorf("Systemd not supported")
}

func Freeze(c *cgroups.Cgroup, state cgroups.FreezerState) error {
return fmt.Errorf("Systemd not supported")
}
Expand Down
6 changes: 6 additions & 0 deletions cgroups/systemd/apply_systemd.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,12 @@ func joinDevices(c *cgroups.Cgroup, pid int) error {
return nil
}

// Symmetrical public function to update device based cgroups. Also available
// in the fs implementation.
func ApplyDevices(c *cgroups.Cgroup, pid int) error {
return joinDevices(c, pid)
}

func joinMemory(c *cgroups.Cgroup, pid int) error {
memorySwap := c.MemorySwap

Expand Down

0 comments on commit 0f49d1f

Please sign in to comment.