From e668288fafe378ab4dc7fbb23ac933a15a2fff94 Mon Sep 17 00:00:00 2001 From: Ayush Ranjan Date: Sat, 6 Mar 2021 22:04:58 -0800 Subject: [op] Replace syscall package usage with golang.org/x/sys/unix in runsc/. The syscall package has been deprecated in favor of golang.org/x/sys. Note that syscall is still used in some places because the following don't seem to have an equivalent in unix package: - syscall.SysProcIDMap - syscall.Credential Updates #214 PiperOrigin-RevId: 361381490 --- runsc/cgroup/cgroup.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'runsc/cgroup/cgroup.go') diff --git a/runsc/cgroup/cgroup.go b/runsc/cgroup/cgroup.go index ac9e4e3a8..438b7ef3e 100644 --- a/runsc/cgroup/cgroup.go +++ b/runsc/cgroup/cgroup.go @@ -27,7 +27,6 @@ import ( "path/filepath" "strconv" "strings" - "syscall" "time" "github.com/cenkalti/backoff" @@ -111,7 +110,7 @@ func setValue(path, name, data string) error { err := ioutil.WriteFile(fullpath, []byte(data), 0700) if err == nil { return nil - } else if !errors.Is(err, syscall.EINTR) { + } else if !errors.Is(err, unix.EINTR) { return err } } @@ -161,7 +160,7 @@ func fillFromAncestor(path string) (string, error) { err := ioutil.WriteFile(path, []byte(val), 0700) if err == nil { break - } else if !errors.Is(err, syscall.EINTR) { + } else if !errors.Is(err, unix.EINTR) { return "", err } } @@ -337,7 +336,7 @@ func (c *Cgroup) Install(res *specs.LinuxResources) error { c.Own[key] = true if err := os.MkdirAll(path, 0755); err != nil { - if cfg.optional && errors.Is(err, syscall.EROFS) { + if cfg.optional && errors.Is(err, unix.EROFS) { log.Infof("Skipping cgroup %q", key) continue } @@ -370,7 +369,7 @@ func (c *Cgroup) Uninstall() error { defer cancel() b := backoff.WithContext(backoff.NewConstantBackOff(100*time.Millisecond), ctx) fn := func() error { - err := syscall.Rmdir(path) + err := unix.Rmdir(path) if os.IsNotExist(err) { return nil } -- cgit v1.2.3