go/src/runtime/os_linux_futex32.go
Jorropo 9a5a1202f4 runtime: clean dead architectures from go:build constraint
I've didn't caught theses while reviewing CL 701615.

Change-Id: I721978c173a255eb6d7c3e43dea2b903a9fd016d
Reviewed-on: https://go-review.googlesource.com/c/go/+/712740
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2025-10-21 07:03:33 -07:00

40 lines
1.1 KiB
Go

// Copyright 2025 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build linux && (386 || arm || mips || mipsle)
package runtime
import (
"internal/runtime/atomic"
"unsafe"
)
//go:noescape
func futex_time32(addr unsafe.Pointer, op int32, val uint32, ts *timespec32, addr2 unsafe.Pointer, val3 uint32) int32
//go:noescape
func futex_time64(addr unsafe.Pointer, op int32, val uint32, ts *timespec, addr2 unsafe.Pointer, val3 uint32) int32
var is32bitOnly atomic.Bool
//go:nosplit
func futex(addr unsafe.Pointer, op int32, val uint32, ts *timespec, addr2 unsafe.Pointer, val3 uint32) int32 {
if !is32bitOnly.Load() {
ret := futex_time64(addr, op, val, ts, addr2, val3)
// futex_time64 is only supported on Linux 5.0+
if ret != -_ENOSYS {
return ret
}
is32bitOnly.Store(true)
}
// Downgrade ts.
var ts32 timespec32
var pts32 *timespec32
if ts != nil {
ts32.setNsec(ts.tv_sec*1e9 + ts.tv_nsec)
pts32 = &ts32
}
return futex_time32(addr, op, val, pts32, addr2, val3)
}