6 int __timedwait(volatile int *addr, int val, clockid_t clk, const struct timespec *at, int priv)
11 clock_gettime(clk, &to);
12 to.tv_sec = at->tv_sec - to.tv_sec;
13 if ((to.tv_nsec = at->tv_nsec - to.tv_nsec) < 0) {
15 to.tv_nsec += 1000000000;
17 if (to.tv_sec < 0) return ETIMEDOUT;
19 if (priv) priv = 128; priv=0;
20 r = -__syscall(__NR_futex, (long)addr, FUTEX_WAIT | priv, val, at ? (long)&to : 0);
21 if (r == ETIMEDOUT) return r;