aboutsummaryrefslogtreecommitdiff
path: root/internal/syscallcompat
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-06-21 13:25:12 +0200
committerJakob Unterwurzacher2020-06-21 13:25:12 +0200
commitf6ded09e36a679695354f4b9bc74242ef399be09 (patch)
tree4ed4c3986682a3b342152e3693dee8ba707dc276 /internal/syscallcompat
parent74a4accf0cc1fd3265abd8fa53b0721cd72c2158 (diff)
v2api: implement Create
Diffstat (limited to 'internal/syscallcompat')
-rw-r--r--internal/syscallcompat/sys_linux.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/syscallcompat/sys_linux.go b/internal/syscallcompat/sys_linux.go
index e2b19bb..02064ac 100644
--- a/internal/syscallcompat/sys_linux.go
+++ b/internal/syscallcompat/sys_linux.go
@@ -2,6 +2,7 @@
package syscallcompat
import (
+ "context"
"fmt"
"io/ioutil"
"runtime"
@@ -88,6 +89,20 @@ func getSupplementaryGroups(pid uint32) (gids []int) {
return nil
}
+// OpenatUserCtx is a tries to extract a fuse.Context from the generic ctx and
+// calls OpenatUser.
+func OpenatUserCtx(dirfd int, path string, flags int, mode uint32, ctx context.Context) (fd int, err error) {
+ var ctx2 *fuse.Context
+ if ctx != nil {
+ if caller, ok := fuse.FromContext(ctx); ok {
+ ctx2 = &fuse.Context{
+ Caller: *caller,
+ }
+ }
+ }
+ return OpenatUser(dirfd, path, flags, mode, ctx2)
+}
+
// OpenatUser runs the Openat syscall in the context of a different user.
func OpenatUser(dirfd int, path string, flags int, mode uint32, context *fuse.Context) (fd int, err error) {
if context != nil {