Portability fixes for containerd shim
Update go-runc to master with portability fixes. Subreaper only exists on Linux, and only Linux runs the shim in a mount namespace. With these changes the shim compiles on Darwin, which means the whole build compiles without errors now. Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
"os/signal"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
@@ -17,9 +16,7 @@ import (
|
||||
shimapi "github.com/containerd/containerd/api/services/shim"
|
||||
"github.com/containerd/containerd/linux/shim"
|
||||
"github.com/containerd/containerd/reaper"
|
||||
"github.com/containerd/containerd/sys"
|
||||
"github.com/containerd/containerd/version"
|
||||
runc "github.com/containerd/go-runc"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
@@ -81,21 +78,6 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
// set the shim as the subreaper for all orphaned processes created by the container
|
||||
if err := sys.SetSubreaper(1); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return signals, nil
|
||||
}
|
||||
|
||||
// serve serves the grpc API over a unix socket at the provided path
|
||||
// this function does not block
|
||||
func serve(server *grpc.Server, path string) error {
|
||||
@@ -131,8 +113,3 @@ func handleSignals(signals chan os.Signal, server *grpc.Server) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// setupRoot sets up the root as the shim is started in its own mount namespace
|
||||
func setupRoot() error {
|
||||
return unix.Mount("", "/", "", unix.MS_SLAVE|unix.MS_REC, "")
|
||||
}
|
||||
|
Reference in New Issue
Block a user