Skip to content

Commit

Permalink
Moving the rest of runc to x/sys/unix
Browse files Browse the repository at this point in the history
Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com>
  • Loading branch information
clnperez committed May 11, 2017
1 parent 852f375 commit d3618be
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
5 changes: 3 additions & 2 deletions checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion list.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"syscall"
"syscall" // avoid use if possible
"text/tabwriter"
"time"

Expand Down
5 changes: 3 additions & 2 deletions restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ package main
import (
"fmt"
"os"
"syscall"

"github.com/Sirupsen/logrus"
"github.com/opencontainers/runc/libcontainer"
"github.com/opencontainers/runc/libcontainer/configs"
"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{
Expand Down Expand Up @@ -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
}
Expand Down
5 changes: 3 additions & 2 deletions utils_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"os"
"path/filepath"
"strconv"
"syscall"

"github.com/Sirupsen/logrus"
"github.com/coreos/go-systemd/activation"
Expand All @@ -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")
Expand Down Expand Up @@ -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()
}

Expand Down

0 comments on commit d3618be

Please sign in to comment.