diff options
| author | Kir Kolyshkin <kolyshkin@gmail.com> | 2025-09-03 16:12:39 -0700 |
|---|---|---|
| committer | Kirill Kolyshkin <kolyshkin@gmail.com> | 2025-09-15 11:46:39 -0700 |
| commit | 68c6a73380e82a0ea9a93c1a75ab8a38f28f3a3d (patch) | |
| tree | 982a853333f6f068ef77bfb16d9cef97dac60a7c /src/os/exec | |
| parent | e603e9834e83ec67f0dd39c4e77683eef0593946 (diff) | |
| download | go-68c6a73380e82a0ea9a93c1a75ab8a38f28f3a3d.tar.xz | |
internal/syscall/unix: add KernelVersionGE
There are a few places in the code which checks that the running kernel
is greater than or equal to x.y. The check takes a few lines and the
checking code is somewhat distracting.
Let's abstract this check into a simple function, KernelVersionGE,
and convert the users accordingly.
Add a test case (I'm not sure it has much value, can be dropped).
Change-Id: I8ec91dcc7452363361f95e46794701c0ae57d956
Reviewed-on: https://go-review.googlesource.com/c/go/+/700796
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Diffstat (limited to 'src/os/exec')
| -rw-r--r-- | src/os/exec/lp_linux_test.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/os/exec/lp_linux_test.go b/src/os/exec/lp_linux_test.go index a7f9aa24b8..1436763038 100644 --- a/src/os/exec/lp_linux_test.go +++ b/src/os/exec/lp_linux_test.go @@ -19,7 +19,7 @@ func TestFindExecutableVsNoexec(t *testing.T) { t.Parallel() // This test case relies on faccessat2(2) syscall, which appeared in Linux v5.8. - if major, minor := unix.KernelVersion(); major < 5 || (major == 5 && minor < 8) { + if !unix.KernelVersionGE(5, 8) { t.Skip("requires Linux kernel v5.8 with faccessat2(2) syscall") } |
