Browse code

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

Michael Crosby authored on 2014/07/15 04:49:50
Showing 4 changed files
... ...
@@ -1,3 +1,5 @@
1
+// +build linux
2
+
1 3
 package native
2 4
 
3 5
 import (
... ...
@@ -1,3 +1,5 @@
1
+// +build linux
2
+
1 3
 package native
2 4
 
3 5
 import (
... ...
@@ -16,6 +18,7 @@ import (
16 16
 	"github.com/docker/libcontainer/cgroups/fs"
17 17
 	"github.com/docker/libcontainer/cgroups/systemd"
18 18
 	"github.com/docker/libcontainer/namespaces"
19
+	"github.com/docker/libcontainer/syncpipe"
19 20
 	"github.com/dotcloud/docker/daemon/execdriver"
20 21
 	"github.com/dotcloud/docker/pkg/system"
21 22
 )
... ...
@@ -32,6 +35,7 @@ func init() {
32 32
 		if err != nil {
33 33
 			return err
34 34
 		}
35
+
35 36
 		if err := json.NewDecoder(f).Decode(&container); err != nil {
36 37
 			f.Close()
37 38
 			return err
... ...
@@ -42,13 +46,16 @@ func init() {
42 42
 		if err != nil {
43 43
 			return err
44 44
 		}
45
-		syncPipe, err := namespaces.NewSyncPipeFromFd(0, uintptr(args.Pipe))
45
+
46
+		syncPipe, err := syncpipe.NewSyncPipeFromFd(0, uintptr(args.Pipe))
46 47
 		if err != nil {
47 48
 			return err
48 49
 		}
50
+
49 51
 		if err := namespaces.Init(container, rootfs, args.Console, syncPipe, args.Args); err != nil {
50 52
 			return err
51 53
 		}
54
+
52 55
 		return nil
53 56
 	})
54 57
 }
55 58
new file mode 100644
... ...
@@ -0,0 +1,13 @@
0
+// +build !linux
1
+
2
+package native
3
+
4
+import (
5
+	"fmt"
6
+
7
+	"github.com/dotcloud/docker/daemon/execdriver"
8
+)
9
+
10
+func NewDriver(root, initPath string) (execdriver.Driver, error) {
11
+	return nil, fmt.Errorf("native driver not supported on non-linux")
12
+}
... ...
@@ -1,3 +1,5 @@
1
+// +build linux
2
+
1 3
 package native
2 4
 
3 5
 import (