diff --git a/docker/pkg/system/mknod.go b/docker/pkg/system/mknod.go index cc020a0d..a892ea2f 100644 --- a/docker/pkg/system/mknod.go +++ b/docker/pkg/system/mknod.go @@ -1,4 +1,5 @@ // +build !windows +// +build !freebsd package system // import "github.com/ory/dockertest/v3/docker/pkg/system" diff --git a/docker/pkg/system/mknod_freebsd.go b/docker/pkg/system/mknod_freebsd.go new file mode 100644 index 00000000..90934cb0 --- /dev/null +++ b/docker/pkg/system/mknod_freebsd.go @@ -0,0 +1,22 @@ +// +build freebsd + +package system // import "github.com/ory/dockertest/v3/docker/pkg/system" + +import ( + "golang.org/x/sys/unix" +) + +// Mknod creates a filesystem node (file, device special file or named pipe) named path +// with attributes specified by mode and dev. +func Mknod(path string, mode uint32, dev int) error { + return unix.Mknod(path, mode, uint64(dev)) +} + +// Mkdev is used to build the value of linux devices (in /dev/) which specifies major +// and minor number of the newly created device special file. +// Linux device nodes are a bit weird due to backwards compat with 16 bit device nodes. +// They are, from low to high: the lower 8 bits of the minor, then 12 bits of the major, +// then the top 12 bits of the minor. +func Mkdev(major int64, minor int64) uint32 { + return uint32(unix.Mkdev(uint32(major), uint32(minor))) +} diff --git a/docker/pkg/system/mknod_windows.go b/docker/pkg/system/mknod_windows.go index 0a694970..fa732a10 100644 --- a/docker/pkg/system/mknod_windows.go +++ b/docker/pkg/system/mknod_windows.go @@ -1,3 +1,4 @@ +// +build windows package system // import "github.com/ory/dockertest/v3/docker/pkg/system" // Mknod is not implemented on Windows.