From 310984bf54a52b15085e195a402873ab558d34d4 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 19 Oct 2020 12:01:23 +0200 Subject: [PATCH] syscall, cmd/go/internal/modload: add and use Access on aix Implement Access using Faccessat on aix following golang.org/x/sys/unix CL 262897 and switch cmd/go/internal/modload to use it to implement hasWritePerm. Change-Id: I682e44737ac2bac5a203ac1c9ddd277810454426 Reviewed-on: https://go-review.googlesource.com/c/go/+/263540 Trust: Tobias Klauser Run-TryBot: Tobias Klauser TryBot-Result: Go Bot Reviewed-by: Ian Lance Taylor Reviewed-by: Bryan C. Mills --- src/cmd/go/internal/modload/stat_openfile.go | 2 +- src/cmd/go/internal/modload/stat_unix.go | 2 +- src/syscall/syscall_aix.go | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cmd/go/internal/modload/stat_openfile.go b/src/cmd/go/internal/modload/stat_openfile.go index 7cdeaf47a2..5842b858f0 100644 --- a/src/cmd/go/internal/modload/stat_openfile.go +++ b/src/cmd/go/internal/modload/stat_openfile.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix js,wasm plan9 +// +build js,wasm plan9 // On plan9, per http://9p.io/magic/man2html/2/access: “Since file permissions // are checked by the server and group information is not known to the client, diff --git a/src/cmd/go/internal/modload/stat_unix.go b/src/cmd/go/internal/modload/stat_unix.go index 65068444d0..f49278ec3a 100644 --- a/src/cmd/go/internal/modload/stat_unix.go +++ b/src/cmd/go/internal/modload/stat_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin dragonfly freebsd linux netbsd openbsd solaris +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package modload diff --git a/src/syscall/syscall_aix.go b/src/syscall/syscall_aix.go index 8837dd5a7f..9c6afba442 100644 --- a/src/syscall/syscall_aix.go +++ b/src/syscall/syscall_aix.go @@ -45,6 +45,10 @@ func (ts *StTimespec_t) Nano() int64 { * Wrapped */ +func Access(path string, mode uint32) (err error) { + return Faccessat(_AT_FDCWD, path, mode, 0) +} + // fcntl must never be called with cmd=F_DUP2FD because it doesn't work on AIX // There is no way to create a custom fcntl and to keep //sys fcntl easily, // because we need fcntl name for its libc symbol. This is linked with the script. -- 2.48.1