X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Ftime%2Ftimer_settime.c;h=62631aa49cda75f49fba047163747cd29faa60e3;hb=3e4b2cdc1b3b881ffdcd8f2119a7bf850f01954d;hp=00708f0e47a6d90a1c50094beeb0c1f965b407ad;hpb=3990c5c6a40440cdb14746ac080d0ecf8d5d6733;p=musl diff --git a/src/time/timer_settime.c b/src/time/timer_settime.c index 00708f0e..62631aa4 100644 --- a/src/time/timer_settime.c +++ b/src/time/timer_settime.c @@ -1,9 +1,12 @@ #include +#include #include "pthread_impl.h" -int timer_settime(timer_t t, int flags, const struct itimerspec *val, struct itimerspec *old) +int timer_settime(timer_t t, int flags, const struct itimerspec *restrict val, struct itimerspec *restrict old) { - if ((uintptr_t)t & 1) t = (void *)((unsigned long)t / 2); - else t = ((pthread_t)t)->result; - return syscall(SYS_timer_settime, (long)t, flags, val, old); + if ((intptr_t)t < 0) { + pthread_t td = (void *)((uintptr_t)t << 1); + t = (void *)(uintptr_t)(td->timer_id & INT_MAX); + } + return syscall(SYS_timer_settime, t, flags, val, old); }