diff options
| author | Elias Naur <elias.naur@gmail.com> | 2018-09-22 10:30:05 +0200 |
|---|---|---|
| committer | Elias Naur <elias.naur@gmail.com> | 2018-09-24 17:08:51 +0000 |
| commit | f25656d392b38da362afb997e75bc43af49d514c (patch) | |
| tree | 5965bb5e4627effc7ff3eeb2106fa284fb6f659c /src/syscall/syscall_linux_amd64.go | |
| parent | 6054fef17f2eedf3ef4825b6ca5b97e2ecf53bd6 (diff) | |
| download | go-f25656d392b38da362afb997e75bc43af49d514c.tar.xz | |
syscall: replace lstat, lchown, stat to please Android O
Implement Lstat with fstatat and Lchown with Fchownat on
linux/amd64, linux/arm and linux/386. Furthermore, implement Stat
with fstatat on linux/arm and linux/386. Linux/arm64 already had
similar replacements.
The fstatat and fchownat system calls were added in kernel 2.6.16,
which is before the Go minimum, 2.6.23.
The three syscalls then match the android bionic implementation
and avoids the Android O seccomp filter.
Fixes #27797
Change-Id: I07fd5506955d454a1a660fef5af0e1ac1ecb0959
Reviewed-on: https://go-review.googlesource.com/136795
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/syscall/syscall_linux_amd64.go')
| -rw-r--r-- | src/syscall/syscall_linux_amd64.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/syscall/syscall_linux_amd64.go b/src/syscall/syscall_linux_amd64.go index 1a21d9db6f..f740ab4e72 100644 --- a/src/syscall/syscall_linux_amd64.go +++ b/src/syscall/syscall_linux_amd64.go @@ -22,9 +22,7 @@ const ( //sysnb InotifyInit() (fd int, err error) //sys Ioperm(from int, num int, on int) (err error) //sys Iopl(level int) (err error) -//sys Lchown(path string, uid int, gid int) (err error) //sys Listen(s int, n int) (err error) -//sys Lstat(path string, stat *Stat_t) (err error) //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK @@ -66,6 +64,14 @@ func Stat(path string, stat *Stat_t) (err error) { return fstatat(_AT_FDCWD, path, stat, 0) } +func Lchown(path string, uid int, gid int) (err error) { + return Fchownat(_AT_FDCWD, path, uid, gid, _AT_SYMLINK_NOFOLLOW) +} + +func Lstat(path string, stat *Stat_t) (err error) { + return fstatat(_AT_FDCWD, path, stat, _AT_SYMLINK_NOFOLLOW) +} + //go:noescape func gettimeofday(tv *Timeval) (err Errno) |
