//go:build linux package platform import ( "os" "syscall" ) // LOOP_CHANGE_FD from . 0x4C08 is LOOP_SET_DIRECT_IO and was // the reason every runtime Copy to RAM attempt ended in EINVAL. const ioctlLoopChangeFD = 0x4C06 func loopChangeFD(loopDev, newFile string) error { lf, err := os.OpenFile(loopDev, os.O_RDWR, 0) if err != nil { return err } defer lf.Close() nf, err := os.OpenFile(newFile, os.O_RDONLY, 0) if err != nil { return err } defer nf.Close() _, _, errno := syscall.Syscall(syscall.SYS_IOCTL, lf.Fd(), ioctlLoopChangeFD, nf.Fd()) if errno != 0 { return errno } return nil } // bindMount binds src over dst using the syscall directly (avoids exec PATH issues). func bindMount(src, dst string) error { return syscall.Mount(src, dst, "", syscall.MS_BIND, "") }