aboutsummaryrefslogtreecommitdiff
path: root/internal/syscallcompat/sys_common.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-06-11 23:39:27 +0200
committerJakob Unterwurzacher2020-06-21 12:01:34 +0200
commit6aa9f5636f03392b5da5fc19dc4ea908e2e55e26 (patch)
treed173bfb7f5d03e9a46026af5c34701a2b06a557d /internal/syscallcompat/sys_common.go
parent9b8ce55383fb6a0a146d0551a63d62b59be6eeb7 (diff)
v2api: implement Lookup()
Compiles, but untested otherwise. No caching.
Diffstat (limited to 'internal/syscallcompat/sys_common.go')
-rw-r--r--internal/syscallcompat/sys_common.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/syscallcompat/sys_common.go b/internal/syscallcompat/sys_common.go
index b6bbdff..d5e3251 100644
--- a/internal/syscallcompat/sys_common.go
+++ b/internal/syscallcompat/sys_common.go
@@ -107,6 +107,18 @@ func Fstatat(dirfd int, path string, stat *unix.Stat_t, flags int) (err error) {
return unix.Fstatat(dirfd, path, stat, flags)
}
+// Fstatat2 is a more convenient version of Fstatat. It allocates a Stat_t
+// for you and also handles the Unix2syscall conversion.
+func Fstatat2(dirfd int, path string, flags int) (*syscall.Stat_t, error) {
+ var stUnix unix.Stat_t
+ err := Fstatat(dirfd, path, &stUnix, flags)
+ if err != nil {
+ return nil, err
+ }
+ st := Unix2syscall(stUnix)
+ return &st, nil
+}
+
const XATTR_SIZE_MAX = 65536
// Make the buffer 1kB bigger so we can detect overflows