aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/os_linux.go
diff options
context:
space:
mode:
authorDaniel Maslowski <info@orangecms.org>2025-09-18 15:43:42 +0000
committerJorropo <jorropo.pgm@gmail.com>2025-09-18 21:04:12 -0700
commit3cf1aaf8b9c846c44ec8db679495dd5816d1ec30 (patch)
treec48799377d006b2e9d82ffd90699464cee224698 /src/runtime/os_linux.go
parent0ab038af6290c7fb52d4c26949d735692781b3d1 (diff)
downloadgo-3cf1aaf8b9c846c44ec8db679495dd5816d1ec30.tar.xz
runtime: use futexes with 64-bit time on Linux
Linux introduced new syscalls to fix the year 2038 issue. To still be able to use the old ones, the Kconfig option COMPAT_32BIT_TIME would be necessary. Use the new syscall with 64-bit values for futex by default. Define _ENOSYS for detecting if it's not available. Add a fallback to use the older syscall in case the new one is not available, since Go runs on Linux from 2.6.32 on, per https://go.dev/wiki/MinimumRequirements. Updates #75133 Change-Id: I65daff0a3d06b55440ff05d8f5a9aa1c07eb201d GitHub-Last-Rev: 96dd1bd84bd12d898e971157fc83da562cc4f6b4 GitHub-Pull-Request: golang/go#75306 Reviewed-on: https://go-review.googlesource.com/c/go/+/701615 Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com> Reviewed-by: Jorropo <jorropo.pgm@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/runtime/os_linux.go')
-rw-r--r--src/runtime/os_linux.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go
index f9fe1b5f33..080dd96532 100644
--- a/src/runtime/os_linux.go
+++ b/src/runtime/os_linux.go
@@ -40,9 +40,6 @@ type mOS struct {
waitsema uint32 // semaphore for parking on locks
}
-//go:noescape
-func futex(addr unsafe.Pointer, op int32, val uint32, ts, addr2 unsafe.Pointer, val3 uint32) int32
-
// Linux futex.
//
// futexsleep(uint32 *addr, uint32 val)
@@ -79,7 +76,7 @@ func futexsleep(addr *uint32, val uint32, ns int64) {
var ts timespec
ts.setNsec(ns)
- futex(unsafe.Pointer(addr), _FUTEX_WAIT_PRIVATE, val, unsafe.Pointer(&ts), nil, 0)
+ futex(unsafe.Pointer(addr), _FUTEX_WAIT_PRIVATE, val, &ts, nil, 0)
}
// If any procs are sleeping on addr, wake up at most cnt.