MCPcopy
hub / github.com/opencontainers/runc / bindMountDeviceNode

Function bindMountDeviceNode

libcontainer/rootfs_linux.go:975–985  ·  view source on GitHub ↗
(destDir *os.File, destName string, node *devices.Device)

Source from the content-addressed store, hash-verified

973}
974
975func bindMountDeviceNode(destDir *os.File, destName string, node *devices.Device) error {
976 dstFile, err := utils.Openat(destDir, destName, unix.O_CREAT|unix.O_NOFOLLOW|unix.O_CLOEXEC, 0o000)
977 if err != nil {
978 return fmt.Errorf("create device inode %s: %w", node.Path, err)
979 }
980 defer dstFile.Close()
981
982 return utils.WithProcfdFile(dstFile, func(dstFd string) error {
983 return mountViaFds(node.Path, nil, dstFile.Name(), dstFd, "bind", unix.MS_BIND, "")
984 })
985}
986
987// Creates the device node in the rootfs of the container.
988func createDeviceNode(rootFd *os.File, node *devices.Device, bind bool) error {

Callers 1

createDeviceNodeFunction · 0.85

Calls 4

OpenatFunction · 0.92
WithProcfdFileFunction · 0.92
mountViaFdsFunction · 0.85
CloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…