github.com/mutagen-io/mutagen@v0.18.0-rc1/pkg/filesystem/file_posix.go (about) 1 //go:build !windows 2 3 package filesystem 4 5 // file is the readable file implementation used on POSIX systems. We avoid 6 // using os.File because its construction and operation can be expensive, its 7 // internals are complex, and it doesn't add any benefit for regular on-disk 8 // files (since polling and asynchronous I/O aren't currently supported). 9 type file int 10 11 // Read implements io.Reader.Read. 12 func (f file) Read(buffer []byte) (int, error) { 13 return readRetryingOnEINTR(int(f), buffer) 14 } 15 16 // Seek implements io.Seeker.Seek. 17 func (f file) Seek(offset int64, whence int) (int64, error) { 18 return seekConsideringEINTR(int(f), offset, whence) 19 } 20 21 // Close implements io.Closer.Close. 22 func (f file) Close() error { 23 return closeConsideringEINTR(int(f)) 24 }