Skip to content

Commit 46586e3

Browse files
authored
Fix freebsd (#324)
See ory/kratos#1645
1 parent 2116fb8 commit 46586e3

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

docker/pkg/system/mknod.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// +build !windows
2+
// +build !freebsd
23

34
package system // import "github.com/ory/dockertest/v3/docker/pkg/system"
45

docker/pkg/system/mknod_freebsd.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// +build freebsd
2+
3+
package system // import "github.com/ory/dockertest/v3/docker/pkg/system"
4+
5+
import (
6+
"golang.org/x/sys/unix"
7+
)
8+
9+
// Mknod creates a filesystem node (file, device special file or named pipe) named path
10+
// with attributes specified by mode and dev.
11+
func Mknod(path string, mode uint32, dev int) error {
12+
return unix.Mknod(path, mode, uint64(dev))
13+
}
14+
15+
// Mkdev is used to build the value of linux devices (in /dev/) which specifies major
16+
// and minor number of the newly created device special file.
17+
// Linux device nodes are a bit weird due to backwards compat with 16 bit device nodes.
18+
// They are, from low to high: the lower 8 bits of the minor, then 12 bits of the major,
19+
// then the top 12 bits of the minor.
20+
func Mkdev(major int64, minor int64) uint32 {
21+
return uint32(unix.Mkdev(uint32(major), uint32(minor)))
22+
}

docker/pkg/system/mknod_windows.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// +build windows
12
package system // import "github.com/ory/dockertest/v3/docker/pkg/system"
23

34
// Mknod is not implemented on Windows.

0 commit comments

Comments
 (0)