From 67d40a823960ea8eba5e4092da17a8efe75493fb Mon Sep 17 00:00:00 2001 From: Christy Perez Date: Thu, 11 May 2017 11:06:37 -0400 Subject: [PATCH] Moving the rest of runc to x/sys/unix Signed-off-by: Christy Perez --- checkpoint.go | 5 +++-- delete.go | 4 +++- list.go | 5 +++-- restore.go | 5 +++-- utils_linux.go | 5 +++-- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/checkpoint.go b/checkpoint.go index 9b5663f371f..788f33475ec 100644 --- a/checkpoint.go +++ b/checkpoint.go @@ -6,11 +6,12 @@ import ( "fmt" "strconv" "strings" - "syscall" "github.com/opencontainers/runc/libcontainer" "github.com/opencontainers/runtime-spec/specs-go" "github.com/urfave/cli" + + "golang.org/x/sys/unix" ) var checkpointCommand = cli.Command{ @@ -113,7 +114,7 @@ func setManageCgroupsMode(context *cli.Context, options *libcontainer.CriuOpts) } var namespaceMapping = map[specs.LinuxNamespaceType]int{ - specs.NetworkNamespace: syscall.CLONE_NEWNET, + specs.NetworkNamespace: unix.CLONE_NEWNET, } func setEmptyNsMask(context *cli.Context, options *libcontainer.CriuOpts) error { diff --git a/delete.go b/delete.go index b43dcaa7cd9..4c014d474df 100644 --- a/delete.go +++ b/delete.go @@ -11,10 +11,12 @@ import ( "github.com/opencontainers/runc/libcontainer" "github.com/urfave/cli" + + "golang.org/x/sys/unix" ) func killContainer(container libcontainer.Container) error { - _ = container.Signal(syscall.SIGKILL, false) + _ = container.Signal(unix.SIGKILL, false) for i := 0; i < 100; i++ { time.Sleep(100 * time.Millisecond) if err := container.Signal(syscall.Signal(0), false); err != nil { diff --git a/list.go b/list.go index 1c3b9aa8352..64783fa71f1 100644 --- a/list.go +++ b/list.go @@ -7,7 +7,6 @@ import ( "io/ioutil" "os" "path/filepath" - "syscall" "text/tabwriter" "time" @@ -17,6 +16,8 @@ import ( "github.com/opencontainers/runc/libcontainer/user" "github.com/opencontainers/runc/libcontainer/utils" "github.com/urfave/cli" + + "golang.org/x/sys/unix" ) const formatOptions = `table or json` @@ -132,7 +133,7 @@ func getContainers(context *cli.Context) ([]containerState, error) { for _, item := range list { if item.IsDir() { // This cast is safe on Linux. - stat := item.Sys().(*syscall.Stat_t) + stat := item.Sys().(*unix.Stat_t) owner, err := user.LookupUid(int(stat.Uid)) if err != nil { owner.Name = string(stat.Uid) diff --git a/restore.go b/restore.go index 7ddc3373b29..7e770a7fc68 100644 --- a/restore.go +++ b/restore.go @@ -5,7 +5,6 @@ package main import ( "fmt" "os" - "syscall" "github.com/Sirupsen/logrus" "github.com/opencontainers/runc/libcontainer" @@ -13,6 +12,8 @@ import ( "github.com/opencontainers/runc/libcontainer/specconv" "github.com/opencontainers/runtime-spec/specs-go" "github.com/urfave/cli" + + "golang.org/x/sys/unix" ) var restoreCommand = cli.Command{ @@ -189,7 +190,7 @@ func restoreContainer(context *cli.Context, spec *specs.Spec, config *configs.Co } if pidFile := context.String("pid-file"); pidFile != "" { if err := createPidFile(pidFile, process); err != nil { - _ = process.Signal(syscall.SIGKILL) + _ = process.Signal(unix.SIGKILL) _, _ = process.Wait() return -1, err } diff --git a/utils_linux.go b/utils_linux.go index c6a8c028e6a..1d7b7b02a54 100644 --- a/utils_linux.go +++ b/utils_linux.go @@ -9,7 +9,6 @@ import ( "os" "path/filepath" "strconv" - "syscall" "github.com/Sirupsen/logrus" "github.com/coreos/go-systemd/activation" @@ -20,6 +19,8 @@ import ( "github.com/opencontainers/runc/libcontainer/utils" "github.com/opencontainers/runtime-spec/specs-go" "github.com/urfave/cli" + + "golang.org/x/sys/unix" ) var errEmptyID = errors.New("container id cannot be empty") @@ -308,7 +309,7 @@ func (r *runner) destroy() { } func (r *runner) terminate(p *libcontainer.Process) { - _ = p.Signal(syscall.SIGKILL) + _ = p.Signal(unix.SIGKILL) _, _ = p.Wait() }