all: Switch from package syscall to golang.org/x/sys/unix

The syscall package is locked down and the comment in [1] advises to
switch code to use the corresponding package from golang.org/x/sys. Do
so and replace usage of package syscall where possible (leave
syscall.SysProcAttr and syscall.Stat_t).

  [1] https://github.com/golang/go/blob/master/src/syscall/syscall.go#L21-L24

This will also allow to get updates and fixes just by re-vendoring
golang.org/x/sys/unix instead of having to update to a new go version.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
This commit is contained in:
Tobias Klauser 2017-06-28 17:47:31 +02:00
parent c9edee9af2
commit 822172a892
7 changed files with 24 additions and 23 deletions

View file

@ -9,13 +9,13 @@ import (
"os/signal"
"sort"
"strings"
"syscall"
"github.com/Sirupsen/logrus"
"github.com/containers/storage/pkg/reexec"
"github.com/kubernetes-incubator/cri-o/server"
"github.com/opencontainers/selinux/go-selinux"
"github.com/urfave/cli"
"golang.org/x/sys/unix"
"google.golang.org/grpc"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
)
@ -117,13 +117,13 @@ func mergeConfig(config *server.Config, ctx *cli.Context) error {
func catchShutdown(gserver *grpc.Server, sserver *server.Server, signalled *bool) {
sig := make(chan os.Signal, 10)
signal.Notify(sig, syscall.SIGINT, syscall.SIGTERM)
signal.Notify(sig, unix.SIGINT, unix.SIGTERM)
go func() {
for s := range sig {
switch s {
case syscall.SIGINT:
case unix.SIGINT:
logrus.Debugf("Caught SIGINT")
case syscall.SIGTERM:
case unix.SIGTERM:
logrus.Debugf("Caught SIGTERM")
default:
continue