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

Function setDevices

cgroup2/manager.go:895–914  ·  view source on GitHub ↗
(path string, devices []specs.LinuxDeviceCgroup)

Source from the content-addressed store, hash-verified

893}
894
895func setDevices(path string, devices []specs.LinuxDeviceCgroup) error {
896 if len(devices) == 0 {
897 return nil
898 }
899 insts, license, err := DeviceFilter(devices)
900 if err != nil {
901 return err
902 }
903 dirFD, err := unix.Open(path, unix.O_DIRECTORY|unix.O_RDONLY|unix.O_CLOEXEC, 0o600)
904 if err != nil {
905 return fmt.Errorf("cannot get dir FD for %s", path)
906 }
907 defer unix.Close(dirFD)
908 if _, err := LoadAttachCgroupDeviceFilter(insts, license, dirFD); err != nil {
909 if !canSkipEBPFError(devices) {
910 return err
911 }
912 }
913 return nil
914}
915
916// getSystemdFullPath returns the full systemd path when creating a systemd slice group.
917// the reason this is necessary is because the "-" character has a special meaning in

Callers 1

setResourcesFunction · 0.85

Calls 3

DeviceFilterFunction · 0.85
canSkipEBPFErrorFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…