summaryrefslogtreecommitdiff
path: root/internal/syscallcompat/sys_darwin.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-09-09 11:16:29 +0200
committerJakob Unterwurzacher2020-09-09 11:16:29 +0200
commit8b1df08b8af38aa50084abe492d0aee395492ede (patch)
tree243d931fa3f0c65daafe6c00e8bb3132a506d60e /internal/syscallcompat/sys_darwin.go
parent7c0363dee5966c2cf8751cc449d19a3b5422242a (diff)
syscallcompat: add Renameat2 for Darwin
Diffstat (limited to 'internal/syscallcompat/sys_darwin.go')
-rw-r--r--internal/syscallcompat/sys_darwin.go14
1 files changed, 11 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)
+}