diff options
author | Ayush Ranjan <ayushranjan@google.com> | 2021-03-06 22:04:58 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-03-06 22:07:07 -0800 |
commit | e668288fafe378ab4dc7fbb23ac933a15a2fff94 (patch) | |
tree | 4b75b894e723f7fc9014e50e2b66e5b2c0bb75a8 /runsc/cgroup | |
parent | 0a909ba75a556db6acbb2a30d2e741b365217c83 (diff) |
[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
Diffstat (limited to 'runsc/cgroup')
-rw-r--r-- | runsc/cgroup/cgroup.go | 9 |
1 files changed, 4 insertions, 5 deletions
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 } |