Skip to content

Commit

Permalink
Fix freebsd (#324)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Nov 28, 2021
1 parent 2116fb8 commit 46586e3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions docker/pkg/system/mknod.go
@@ -1,4 +1,5 @@
// +build !windows
// +build !freebsd

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

Expand Down
22 changes: 22 additions & 0 deletions 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)))
}
1 change: 1 addition & 0 deletions 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.
Expand Down

0 comments on commit 46586e3

Please sign in to comment.