summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs/host/util_arm64_unsafe.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2019-11-18 19:59:51 +0000
committergVisor bot <gvisor-bot@google.com>2019-11-18 19:59:51 +0000
commitfb97248393bd2acffab4bb59e3b9fcb32aa9d9fe (patch)
tree3deb7b7c092a924f1cbcc29af625040e183fdf3b /pkg/sentry/fs/host/util_arm64_unsafe.go
parentac49b282fdd81b48b8ad7a6675a2fa0f612d2149 (diff)
parent235a96cab15e64c69fbbdce03c9bb4eb2c30b0d5 (diff)
Merge release-20191114.0-13-g235a96c (automated)
Diffstat (limited to 'pkg/sentry/fs/host/util_arm64_unsafe.go')
-rwxr-xr-xpkg/sentry/fs/host/util_arm64_unsafe.go41
1 files changed, 41 insertions, 0 deletions
diff --git a/pkg/sentry/fs/host/util_arm64_unsafe.go b/pkg/sentry/fs/host/util_arm64_unsafe.go
new file mode 100755
index 000000000..e8cb94aeb
--- /dev/null
+++ b/pkg/sentry/fs/host/util_arm64_unsafe.go
@@ -0,0 +1,41 @@
+// Copyright 2019 The gVisor Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// +build arm64
+
+package host
+
+import (
+ "syscall"
+ "unsafe"
+)
+
+func fstatat(fd int, name string, flags int) (syscall.Stat_t, error) {
+ var stat syscall.Stat_t
+ namePtr, err := syscall.BytePtrFromString(name)
+ if err != nil {
+ return stat, err
+ }
+ _, _, errno := syscall.Syscall6(
+ syscall.SYS_FSTATAT,
+ uintptr(fd),
+ uintptr(unsafe.Pointer(namePtr)),
+ uintptr(unsafe.Pointer(&stat)),
+ uintptr(flags),
+ 0, 0)
+ if errno != 0 {
+ return stat, errno
+ }
+ return stat, nil
+}