mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
63ab12cd3a
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 f3d3994a4b
)
Signed-off-by: Doug Rabson <dfr@rabson.org>
17 lines
609 B
Go
17 lines
609 B
Go
//go:build !windows
|
|
// +build !windows
|
|
|
|
package system // import "github.com/docker/docker/pkg/system"
|
|
|
|
import (
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
// 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)))
|
|
}
|