diff options
Diffstat (limited to 'internal/syscallcompat/eintr.go')
-rw-r--r-- | internal/syscallcompat/eintr.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/internal/syscallcompat/eintr.go b/internal/syscallcompat/eintr.go index f0a82f5..cdde806 100644 --- a/internal/syscallcompat/eintr.go +++ b/internal/syscallcompat/eintr.go @@ -2,6 +2,8 @@ package syscallcompat import ( "syscall" + + "golang.org/x/sys/unix" ) // retryEINTR executes operation `op` and retries if it gets EINTR. @@ -43,6 +45,24 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { return fd, err } +// Renameat wraps the Renameat syscall. +// Retries on EINTR. +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + err = retryEINTR(func() error { + return unix.Renameat(olddirfd, oldpath, newdirfd, newpath) + }) + return err +} + +// Unlinkat syscall. +// Retries on EINTR. +func Unlinkat(dirfd int, path string, flags int) (err error) { + err = retryEINTR(func() error { + return unix.Unlinkat(dirfd, path, flags) + }) + return err +} + // Flush is a helper for the FUSE command FLUSH. // Retries on EINTR. func Flush(fd int) error { |