mknod.go 590 B

12345678910111213141516
  1. //go:build !windows
  2. package system // import "github.com/docker/docker/pkg/system"
  3. import (
  4. "golang.org/x/sys/unix"
  5. )
  6. // Mkdev is used to build the value of linux devices (in /dev/) which specifies major
  7. // and minor number of the newly created device special file.
  8. // Linux device nodes are a bit weird due to backwards compat with 16 bit device nodes.
  9. // They are, from low to high: the lower 8 bits of the minor, then 12 bits of the major,
  10. // then the top 12 bits of the minor.
  11. func Mkdev(major int64, minor int64) uint32 {
  12. return uint32(unix.Mkdev(uint32(major), uint32(minor)))
  13. }