瀏覽代碼

Update native driver for libcontainer changes
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)

Michael Crosby 11 年之前
父節點
當前提交
f00e643576

+ 2 - 0
daemon/execdriver/native/create.go

@@ -1,3 +1,5 @@
+// +build linux
+
 package native
 
 import (

+ 8 - 1
daemon/execdriver/native/driver.go

@@ -1,3 +1,5 @@
+// +build linux
+
 package native
 
 import (
@@ -16,6 +18,7 @@ import (
 	"github.com/docker/libcontainer/cgroups/fs"
 	"github.com/docker/libcontainer/cgroups/systemd"
 	"github.com/docker/libcontainer/namespaces"
+	"github.com/docker/libcontainer/syncpipe"
 	"github.com/dotcloud/docker/daemon/execdriver"
 	"github.com/dotcloud/docker/pkg/system"
 )
@@ -32,6 +35,7 @@ func init() {
 		if err != nil {
 			return err
 		}
+
 		if err := json.NewDecoder(f).Decode(&container); err != nil {
 			f.Close()
 			return err
@@ -42,13 +46,16 @@ func init() {
 		if err != nil {
 			return err
 		}
-		syncPipe, err := namespaces.NewSyncPipeFromFd(0, uintptr(args.Pipe))
+
+		syncPipe, err := syncpipe.NewSyncPipeFromFd(0, uintptr(args.Pipe))
 		if err != nil {
 			return err
 		}
+
 		if err := namespaces.Init(container, rootfs, args.Console, syncPipe, args.Args); err != nil {
 			return err
 		}
+
 		return nil
 	})
 }

+ 13 - 0
daemon/execdriver/native/driver_unsupported.go

@@ -0,0 +1,13 @@
+// +build !linux
+
+package native
+
+import (
+	"fmt"
+
+	"github.com/dotcloud/docker/daemon/execdriver"
+)
+
+func NewDriver(root, initPath string) (execdriver.Driver, error) {
+	return nil, fmt.Errorf("native driver not supported on non-linux")
+}

+ 2 - 0
daemon/execdriver/native/info.go

@@ -1,3 +1,5 @@
+// +build linux
+
 package native
 
 import (