]> Cypherpunks repositories - gostls13.git/commit
internal/syscall/unix: add KernelVersionGE
authorKir Kolyshkin <kolyshkin@gmail.com>
Wed, 3 Sep 2025 23:12:39 +0000 (16:12 -0700)
committerKirill Kolyshkin <kolyshkin@gmail.com>
Mon, 15 Sep 2025 18:46:39 +0000 (11:46 -0700)
commit68c6a73380e82a0ea9a93c1a75ab8a38f28f3a3d
tree982a853333f6f068ef77bfb16d9cef97dac60a7c
parente603e9834e83ec67f0dd39c4e77683eef0593946
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>
src/internal/poll/copy_file_range_linux.go
src/internal/syscall/unix/kernel_version_freebsd.go
src/internal/syscall/unix/kernel_version_ge.go [new file with mode: 0644]
src/internal/syscall/unix/kernel_version_ge_test.go [new file with mode: 0644]
src/internal/syscall/unix/kernel_version_solaris.go
src/net/mptcpsock_linux.go
src/net/sock_linux.go
src/net/sock_linux_test.go
src/os/exec/lp_linux_test.go
src/runtime/pprof/pprof_test.go