diff options
author | Rich Felker <dalias@aerifal.cx> | 2016-01-27 12:23:47 -0500 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2016-01-27 12:23:47 -0500 |
commit | a5ba2d7507eb6b4388c47f7893e025185496ff90 (patch) | |
tree | 0b94153f6f564f75959257a0906e67f3ee6c7cd1 /src/thread/lock_ptc.c | |
parent | 9a3b8f97a160ce292dcf0ef2a9358fa0e11e9ee3 (diff) | |
download | musl-a5ba2d7507eb6b4388c47f7893e025185496ff90.tar.gz |
improve clock_gettime and adapt it to support slightly-broken vdso
these changes are motivated by a functionally similar patch by Hauke
Mehrtens to address the needs of the new mips vdso clock_gettime,
which wrongly fails with ENOSYS rather than falling back to making a
syscall for clock ids it cannot handle from userspace. in the process
of preparing to handle that case, it was noticed that the old
clock_gettime use of the vdso was actually wrong with respect to error
handling -- the tail call to the vdso function failed to set errno and
instead returned an error code.
since tail calls to vdso are no longer possible and since the plain
syscall code is now needed as a fallback path anyway, it does not make
sense to use a function pointer to call the plain syscall code path.
instead, it's inlined at the end of the main clock_gettime function.
the new code also avoids the need to test for initialization of the
vdso function pointer by statically initializing it to a self-init
function, and eliminates redundant loads from the volatile pointer
object.
finally, the use of a_cas_p on an object of type other than void *,
which is not permitted aliasing, is replaced by using an object with
the correct type and casting the value.
Diffstat (limited to 'src/thread/lock_ptc.c')
0 files changed, 0 insertions, 0 deletions