containerd/cmd/containerd-shim/shim_unix.go
Stephen J Day 2d966df174
cmd/containerd-shim: require unix socket credentials
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-30 20:34:29 -08:00

28 lines
707 B
Go

// +build !linux,!windows,!darwin
package main
import (
"os"
"os/signal"
"github.com/containerd/containerd/reaper"
runc "github.com/containerd/go-runc"
"github.com/stevvooe/ttrpc"
)
// setupSignals creates a new signal handler for all signals and sets the shim as a
// sub-reaper so that the container processes are reparented
func setupSignals() (chan os.Signal, error) {
signals := make(chan os.Signal, 2048)
signal.Notify(signals)
// make sure runc is setup to use the monitor
// for waiting on processes
runc.Monitor = reaper.Default
return signals, nil
}
func newServer() (*ttrpc.Server, error) {
return ttrpc.NewServer(ttrpc.WithServerHandshaker(ttrpc.UnixSocketRequireSameUser()))
}