2021-08-23 09:14:53 -04:00
|
|
|
//go:build !windows
|
2014-11-13 15:00:04 -05:00
|
|
|
// +build !windows
|
|
|
|
|
2018-02-05 16:05:59 -05:00
|
|
|
package system // import "github.com/docker/docker/pkg/system"
|
2014-11-13 15:00:04 -05:00
|
|
|
|
|
|
|
import (
|
2017-05-23 10:22:32 -04:00
|
|
|
"golang.org/x/sys/unix"
|
2014-11-13 15:00:04 -05:00
|
|
|
)
|
|
|
|
|
2015-07-28 12:13:12 -04:00
|
|
|
// 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.
|
2014-11-13 15:00:04 -05:00
|
|
|
// 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,
|
2015-07-28 12:13:12 -04:00
|
|
|
// then the top 12 bits of the minor.
|
2014-11-13 15:00:04 -05:00
|
|
|
func Mkdev(major int64, minor int64) uint32 {
|
2017-10-18 04:43:31 -04:00
|
|
|
return uint32(unix.Mkdev(uint32(major), uint32(minor)))
|
2014-11-13 15:00:04 -05:00
|
|
|
}
|