Browse code

Windows: Empty Windows Exec Driver

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2015/05/05 01:44:37
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,13 @@
0
+// +build !windows
1
+
2
+package windows
3
+
4
+import (
5
+	"fmt"
6
+
7
+	"github.com/docker/docker/daemon/execdriver"
8
+)
9
+
10
+func NewDriver(root, initPath string) (execdriver.Driver, error) {
11
+	return nil, fmt.Errorf("Windows driver not supported on non-Windows")
12
+}
0 13
new file mode 100644
... ...
@@ -0,0 +1,97 @@
0
+// +build windows
1
+
2
+/*
3
+ This is the Windows driver for containers.
4
+
5
+ TODO Windows: It is currently a placeholder to allow compilation of the
6
+ daemon. Future PRs will have an implementation of this driver.
7
+*/
8
+
9
+package windows
10
+
11
+import (
12
+	"fmt"
13
+
14
+	"github.com/docker/docker/daemon/execdriver"
15
+)
16
+
17
+const (
18
+	DriverName = "Windows"
19
+	Version    = "Placeholder"
20
+)
21
+
22
+type activeContainer struct {
23
+	command *execdriver.Command
24
+}
25
+
26
+type driver struct {
27
+	root     string
28
+	initPath string
29
+}
30
+
31
+type info struct {
32
+	ID     string
33
+	driver *driver
34
+}
35
+
36
+func NewDriver(root, initPath string) (*driver, error) {
37
+	return &driver{
38
+		root:     root,
39
+		initPath: initPath,
40
+	}, nil
41
+}
42
+
43
+func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallback execdriver.StartCallback) (execdriver.ExitStatus, error) {
44
+	return execdriver.ExitStatus{ExitCode: 0}, nil
45
+}
46
+
47
+func (d *driver) Terminate(p *execdriver.Command) error {
48
+	return nil
49
+}
50
+
51
+func (d *driver) Kill(p *execdriver.Command, sig int) error {
52
+	return nil
53
+}
54
+
55
+func kill(ID string, PID int) error {
56
+	return nil
57
+}
58
+
59
+func (d *driver) Pause(c *execdriver.Command) error {
60
+	return fmt.Errorf("Windows: Containers cannot be paused")
61
+}
62
+
63
+func (d *driver) Unpause(c *execdriver.Command) error {
64
+	return fmt.Errorf("Windows: Containers cannot be paused")
65
+}
66
+
67
+func (i *info) IsRunning() bool {
68
+	return false
69
+}
70
+
71
+func (d *driver) Info(id string) execdriver.Info {
72
+	return &info{
73
+		ID:     id,
74
+		driver: d,
75
+	}
76
+}
77
+
78
+func (d *driver) Name() string {
79
+	return fmt.Sprintf("%s Date %s", DriverName, Version)
80
+}
81
+
82
+func (d *driver) GetPidsForContainer(id string) ([]int, error) {
83
+	return nil, fmt.Errorf("GetPidsForContainer: GetPidsForContainer() not implemented")
84
+}
85
+
86
+func (d *driver) Clean(id string) error {
87
+	return nil
88
+}
89
+
90
+func (d *driver) Stats(id string) (*execdriver.ResourceStats, error) {
91
+	return nil, fmt.Errorf("Windows: Stats not implemented")
92
+}
93
+
94
+func (d *driver) Exec(c *execdriver.Command, processConfig *execdriver.ProcessConfig, pipes *execdriver.Pipes, startCallback execdriver.StartCallback) (int, error) {
95
+	return 0, nil
96
+}