Browse code

Fix downstream client API build errors on Solaris

The client API at fsouza/go-dockerclient has dependencies on packages in
the docker/docker repository which currently do not build on Solaris. In
particular, stat_unsupported.go makes use of the Mtimespec field of the
syscall.Stat_t struct, which is not present on Solaris, and a number of
Unix-specific packages do not list Solaris in their compile targets.

This commit adds enough support to be able to build
fsouza/go-dockerclient on SmartOS using Go 1.5.1 without affecting other
platforms.

Signed-off-by: James Nugent <james@jen20.com>

James Nugent authored on 2015/12/31 08:18:30
Showing 3 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,17 @@
0
+// +build solaris
1
+
2
+package system
3
+
4
+import (
5
+	"syscall"
6
+)
7
+
8
+// fromStatT creates a system.StatT type from a syscall.Stat_t type
9
+func fromStatT(s *syscall.Stat_t) (*StatT, error) {
10
+	return &StatT{size: s.Size,
11
+		mode: uint32(s.Mode),
12
+		uid:  s.Uid,
13
+		gid:  s.Gid,
14
+		rdev: uint64(s.Rdev),
15
+		mtim: s.Mtim}, nil
16
+}
... ...
@@ -1,4 +1,4 @@
1
-// +build !linux,!windows,!freebsd
1
+// +build !linux,!windows,!freebsd,!solaris
2 2
 
3 3
 package system
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// +build linux freebsd darwin
1
+// +build linux freebsd darwin solaris
2 2
 
3 3
 package volume
4 4