8000 Port pkg/system/mknod.go to FreeBSD · moby/moby@63ab12c · GitHub
[go: up one dir, main page]

Skip to content

Commit 63ab12c

Browse files
akhramovdfr
authored andcommitted
Port pkg/system/mknod.go to FreeBSD
Because FreeBSD uses 64-bit device nodes (see https://reviews.freebsd.org/rS318736), Linux implementation of `system.Mknod` & `system.Mkdev` is not sufficient. This change adds freebsd-specific implementations for `Mknod` and Mkdev`. Signed-off-by: Artem Khramov <akhramov@pm.me> (cherry picked from commit f3d3994) Signed-off-by: Doug Rabson <dfr@rabson.org>
1 parent 4159fa6 commit 63ab12c

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

pkg/system/mknod.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ import (
77
"golang.org/x/sys/unix"
88
)
99

10-
// Mknod creates a filesystem node (file, device special file or named pipe) named path
11-
// with attributes specified by mode and dev.
12-
func Mknod(path string, mode uint32, dev int) error {
13-
return unix.Mknod(path, mode, dev)
14-
}
15-
1610
// Mkdev is used to build the value of linux devices (in /dev/) which specifies major
1711
// and minor number of the newly created device special file.
1812
// Linux device nodes are a bit weird due to backwards compat with 16 bit device nodes.

pkg/system/mknod_freebsd.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//go:build freebsd
2+
// +build freebsd
3+
4+
package system // import "github.com/docker/docker/pkg/system"
5+
6+
import (
7+
"golang.org/x/sys/unix"
8+
)
9+
10+
// Mknod creates a filesystem node (file, device special file or named pipe) named path
11+
// with attributes specified by mode and dev.
12+
func Mknod(path string, mode uint32, dev int) error {
13+
return unix.Mknod(path, mode, uint64(dev))
14+
}

pkg/system/mknod_linux.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package system // import "github.com/docker/docker/pkg/system"
2+
3+
import (
4+
"golang.org/x/sys/unix"
5+
)
6+
7+
// Mknod creates a filesystem node (file, device special file or named pipe) named path
8+
// with attributes specified by mode and dev.
9+
func Mknod(path string, mode uint32, dev int) error {
10+
return unix.Mknod(path, mode, dev)
11+
}

0 commit comments

Comments
 (0)
0