summaryrefslogtreecommitdiff
path: root/internal/syscallcompat
diff options
context:
space:
mode:
Diffstat (limited to 'internal/syscallcompat')
-rw-r--r--internal/syscallcompat/sys_darwin.go14
-rw-r--r--internal/syscallcompat/sys_linux.go8
2 files changed, 19 insertions, 3 deletions
diff --git a/internal/syscallcompat/sys_darwin.go b/internal/syscallcompat/sys_darwin.go
index d9e6017..90d5ed6 100644
--- a/internal/syscallcompat/sys_darwin.go
+++ b/internal/syscallcompat/sys_darwin.go
@@ -21,6 +21,9 @@ const (
// O_PATH is only defined on Linux
O_PATH = 0
+ // RENAME_NOREPLACE is only defined on Linux
+ RENAME_NOREPLACE = 0
+
// KAUTH_UID_NONE and KAUTH_GID_NONE are special values to
// revert permissions to the process credentials.
KAUTH_UID_NONE = ^uint32(0) - 100
@@ -131,12 +134,12 @@ func SymlinkatUser(oldpath string, newdirfd int, newpath string, context *fuse.C
return Symlinkat(oldpath, newdirfd, newpath)
}
-func MkdiratUser(dirfd int, path string, mode uint32, context *fuse.Context) (err error) {
- if context != nil {
+func MkdiratUser(dirfd int, path string, mode uint32, caller *fuse.Caller) (err error) {
+ if caller != nil {
runtime.LockOSThread()
defer runtime.UnlockOSThread()
- err = pthread_setugid_np(context.Owner.Uid, context.Owner.Gid)
+ err = pthread_setugid_np(caller.Uid, caller.Gid)
if err != nil {
return err
}
@@ -215,3 +218,8 @@ func UtimesNanoAtNofollow(dirfd int, path string, a *time.Time, m *time.Time) (e
func Getdents(fd int) ([]fuse.DirEntry, error) {
return emulateGetdents(fd)
}
+
+// Renameat2 does not exist on Darwin, so we call Renameat and ignore the flags.
+func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) {
+ return unix.Renameat(olddirfd, oldpath, newdirfd, newpath)
+}
diff --git a/internal/syscallcompat/sys_linux.go b/internal/syscallcompat/sys_linux.go
index 42e9da6..6273504 100644
--- a/internal/syscallcompat/sys_linux.go
+++ b/internal/syscallcompat/sys_linux.go
@@ -27,6 +27,9 @@ const (
// O_PATH is only defined on Linux
O_PATH = unix.O_PATH
+
+ // RENAME_NOREPLACE is only defined on Linux
+ RENAME_NOREPLACE = unix.RENAME_NOREPLACE
)
var preallocWarn sync.Once
@@ -271,3 +274,8 @@ func UtimesNanoAtNofollow(dirfd int, path string, a *time.Time, m *time.Time) (e
func Getdents(fd int) ([]fuse.DirEntry, error) {
return getdents(fd)
}
+
+// Renameat2 does not exist on Darwin, so we have to wrap it here.
+func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) {
+ return unix.Renameat2(olddirfd, oldpath, newdirfd, newpath, flags)
+}