]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.7] runtime: sleep on CLOCK_MONOTONIC in futexsleep1 on freebsd
authorMike Appleby <mike@app.leby.org>
Wed, 28 Sep 2016 21:01:27 +0000 (16:01 -0500)
committerChris Broadfoot <cbro@golang.org>
Mon, 17 Oct 2016 20:25:00 +0000 (20:25 +0000)
commita2f37b7fe130e1a5da78b605f4191547e9868944
tree6ad680b1f1edc9dead88e19eaa13031e349e1a3a
parentca0b97e80a558d06274e68ece667b821901acc42
[release-branch.go1.7] runtime: sleep on CLOCK_MONOTONIC in futexsleep1 on freebsd

In FreeBSD 10.0, the _umtx_op syscall was changed to allow sleeping on
any supported clock, but the default clock was switched from a monotonic
clock to CLOCK_REALTIME.

Prior to 10.0, the __umtx_op_wait* functions ignored the fourth argument
to _umtx_op (uaddr1), expected the fifth argument (uaddr2) to be a
struct timespec pointer, and used a monotonic clock (nanouptime(9)) for
timeout calculations.

Since 10.0, if callers want a clock other than CLOCK_REALTIME, they must
call _umtx_op with uaddr1 set to a value greater than sizeof(struct
timespec), and with uaddr2 as pointer to a struct _umtx_time, rather
than a timespec. Callers can set the _clockid field of the struct
_umtx_time to request the clock they want.

The relevant FreeBSD commit:
    https://svnweb.freebsd.org/base?view=revision&revision=232144

Fixes #17168

Change-Id: I3dd7b32b683622b8d7b4a6a8f9eb56401bed6bdf
Reviewed-on: https://go-review.googlesource.com/30154
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/31269
src/runtime/defs_freebsd.go
src/runtime/defs_freebsd_386.go
src/runtime/defs_freebsd_amd64.go
src/runtime/defs_freebsd_arm.go
src/runtime/os_freebsd.go
src/runtime/sys_freebsd_amd64.s
src/runtime/sys_freebsd_arm.s