github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/daemon/graphdriver/copy/copy_cgo.go (about)

     1  // +build linux,cgo
     2  
     3  package copy // import "github.com/demonoid81/moby/daemon/graphdriver/copy"
     4  
     5  /*
     6  #include <linux/fs.h>
     7  
     8  #ifndef FICLONE
     9  #define FICLONE		_IOW(0x94, 9, int)
    10  #endif
    11  */
    12  import "C"
    13  import (
    14  	"os"
    15  
    16  	"golang.org/x/sys/unix"
    17  )
    18  
    19  func fiClone(srcFile, dstFile *os.File) error {
    20  	_, _, err := unix.Syscall(unix.SYS_IOCTL, dstFile.Fd(), C.FICLONE, srcFile.Fd())
    21  	return err
    22  }