]> Cypherpunks repositories - gostls13.git/commit
internal/syscall/unix: implement Eaccess on all unix platforms
authorKir Kolyshkin <kolyshkin@gmail.com>
Thu, 5 Sep 2024 18:48:00 +0000 (11:48 -0700)
committerGopher Robot <gobot@golang.org>
Fri, 6 Sep 2024 13:29:47 +0000 (13:29 +0000)
commita0d7bfa28683c2f7cf7868330295c9942a2fcdfd
treef24da036819075465ec0be8bb0fca8a1bc8c6a74
parent8f2486d2e03e26ea9bc5f680c1a5795256459b7b
internal/syscall/unix: implement Eaccess on all unix platforms

Eaccess, initially added by CL 414824 for linux only, was later
implemented for freebsd (CL 531155), netbsd (CL 531876), dragonfly
(CL 532675), openbsd (CL 538836), and darwin (CL 579976).

The only unix platforms which lack Eaccess are Solaris/Illumos and AIX.

For AIX, syscall.Faccessat is already available, the only missing piece
was AT_EACCESS constant. Let's take it from [1], which, judging by a few
other known AT_ constants, appears to be accurate.

For Solaris, wire the faccessat using the same logic as in the syscall
package.

Now, when we have faccessat for every unix, we can drop eaccess_other.go
and consolidate Eaccess implementations to use faccessat.

[1]: https://github.com/rust-lang/libc/blob/main/src/unix/aix/mod.rs

Change-Id: I7e1b90dedc5d8174235d3a79d5c662f3dcb909c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/611295
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com>
src/internal/syscall/unix/at_aix.go
src/internal/syscall/unix/at_solaris.go
src/internal/syscall/unix/eaccess.go [moved from src/internal/syscall/unix/eaccess_linux.go with 56% similarity]
src/internal/syscall/unix/eaccess_other.go [deleted file]
src/internal/syscall/unix/faccessat_bsd.go [moved from src/internal/syscall/unix/eaccess_bsd.go with 85% similarity]
src/internal/syscall/unix/faccessat_darwin.go [moved from src/internal/syscall/unix/eaccess_darwin.go with 87% similarity]
src/internal/syscall/unix/faccessat_openbsd.go [moved from src/internal/syscall/unix/eaccess_openbsd.go with 89% similarity]
src/internal/syscall/unix/faccessat_solaris.go [new file with mode: 0644]
src/internal/syscall/unix/faccessat_syscall.go [new file with mode: 0644]