about summary refs log tree commit diff
path: root/src/time/timer_getoverrun.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-04-06 09:26:41 -0400
committerRich Felker <dalias@aerifal.cx>2011-04-06 09:26:41 -0400
commitcd3bb38412cfcc3bc47985ba25287e0af463609a (patch)
treec6359e4b15d56353e6422ba83c7ccd3c6a3018d9 /src/time/timer_getoverrun.c
parent104d0134419eea7539cb5e0cc0405e5c6c9a0dff (diff)
downloadmusl-cd3bb38412cfcc3bc47985ba25287e0af463609a.tar.gz
musl-cd3bb38412cfcc3bc47985ba25287e0af463609a.tar.xz
musl-cd3bb38412cfcc3bc47985ba25287e0af463609a.zip
fix signal-based timers with null sigevent argument
since timer_create is no longer allocating a structure for the timer_t
and simply using the kernel timer id, it was impossible to specify the
timer_t as the argument to the signal handler. the solution is to pass
the null sigevent pointer on to the kernel, rather than filling it in
userspace, so that the kernel does the right thing. however, that
precludes the clever timerid-versus-threadid encoding we were doing.

instead, just assume timerids are below 1M and thread pointers are
above 1M. (in perspective: timerids are sequentially allocated and
seem limited to 32k, and thread pointers are at roughly 3G.)
Diffstat (limited to 'src/time/timer_getoverrun.c')
-rw-r--r--src/time/timer_getoverrun.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/time/timer_getoverrun.c b/src/time/timer_getoverrun.c
index fa7715bb..8a86833d 100644
--- a/src/time/timer_getoverrun.c
+++ b/src/time/timer_getoverrun.c
@@ -3,7 +3,6 @@
 
 int timer_getoverrun(timer_t t)
 {
-	if ((uintptr_t)t & 1) t = (void *)((unsigned long)t / 2);
-	else t = ((pthread_t)t)->result;
+	if ((uintptr_t)t >= 0x100000) t = ((pthread_t)t)->result;
 	return syscall(SYS_timer_getoverrun, (long)t);
 }