diff options
author | Jakob Unterwurzacher | 2021-06-05 15:06:30 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2021-06-05 15:06:30 +0200 |
commit | e48f2377ec46f247d4db04cf8031702d0684c086 (patch) | |
tree | e73aaa369c4549c5289e4dcf099cce19fca0f64b /internal/syscallcompat/eintr.go | |
parent | c0e75302166c9a166526586690086dcd16eff2c2 (diff) |
syscallcompat: drop obsolete wrappers
These are now available cross-platform in the unix
package.
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 { |