Merge pull request #712 from crosbymichael/sysunix

Replace syscall with /x/sys/unix in execution code
This commit is contained in:
Phil Estes 2017-04-10 16:30:32 -04:00 committed by GitHub
commit 62918511f3
104 changed files with 1849 additions and 1398 deletions

View file

@ -8,7 +8,8 @@ import (
"os"
"os/signal"
"strings"
"syscall"
"golang.org/x/sys/unix"
"google.golang.org/grpc"
@ -117,11 +118,11 @@ func handleSignals(signals chan os.Signal, server *grpc.Server) error {
for s := range signals {
logrus.WithField("signal", s).Debug("received signal")
switch s {
case syscall.SIGCHLD:
case unix.SIGCHLD:
if err := reaper.Reap(); err != nil {
logrus.WithError(err).Error("reap exit status")
}
case syscall.SIGTERM, syscall.SIGINT:
case unix.SIGTERM, unix.SIGINT:
// TODO: should we forward signals to the processes if they are still running?
// i.e. machine reboot
server.Stop()
@ -133,5 +134,5 @@ func handleSignals(signals chan os.Signal, server *grpc.Server) error {
// setupRoot sets up the root as the shim is started in its own mount namespace
func setupRoot() error {
return syscall.Mount("", "/", "", syscall.MS_SLAVE|syscall.MS_REC, "")
return unix.Mount("", "/", "", unix.MS_SLAVE|unix.MS_REC, "")
}

View file

@ -4,7 +4,8 @@ package main
import (
"os"
"syscall"
"golang.org/x/sys/unix"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/reaper"
@ -18,7 +19,7 @@ const (
)
var (
handledSignals = []os.Signal{syscall.SIGTERM, syscall.SIGINT, syscall.SIGUSR1, syscall.SIGCHLD}
handledSignals = []os.Signal{unix.SIGTERM, unix.SIGINT, unix.SIGUSR1, unix.SIGCHLD}
)
func platformInit(context *cli.Context) error {
@ -35,7 +36,7 @@ func handleSignals(signals chan os.Signal, server *grpc.Server) error {
for s := range signals {
log.G(global).WithField("signal", s).Debug("received signal")
switch s {
case syscall.SIGCHLD:
case unix.SIGCHLD:
if err := reaper.Reap(); err != nil {
log.G(global).WithError(err).Error("reap containerd processes")
}

View file

@ -7,7 +7,8 @@ import (
"os"
"os/signal"
"runtime"
"syscall"
"golang.org/x/sys/unix"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@ -207,7 +208,7 @@ func handleConsoleResize(ctx gocontext.Context, service execution.ContainerServi
return err
}
s := make(chan os.Signal, 16)
signal.Notify(s, syscall.SIGWINCH)
signal.Notify(s, unix.SIGWINCH)
go func() {
for range s {
size, err := con.Size()