PERFORCE change 102135 for review
Roman Divacky
rdivacky at FreeBSD.org
Sat Jul 22 11:39:35 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=102135
Change 102135 by rdivacky at rdivacky_witten on 2006/07/22 11:39:07
Fix the timeout_hz counting.
Affected files ...
.. //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_futex.c#6 edit
Differences ...
==== //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_futex.c#6 (text+ko) ====
@@ -117,9 +117,24 @@
td->td_proc->p_pid, args->val,
args->uaddr, val, timeout.tv_sec, timeout.tv_nsec);
#endif
- tv.tv_usec = timeout.tv_sec * 1000 + timeout.tv_nsec / 1000000;
+ tv.tv_usec = timeout.tv_sec * 1000000 + timeout.tv_nsec / 1000;
timeout_hz = tvtohz(&tv);
+ if (timeout.tv_sec == 0 && timeout.tv_nsec == 0)
+ timeout_hz = 0;
+ /*
+ * If the user process requests a non null timeout,
+ * make sure we do not turn it into an infinite
+ * timeout because timeout_hz gets null.
+ *
+ * We use a minimal timeout of 1/hz. Mayve it would
+ * make sense to just return ETIMEDOUT without sleeping.
+ */
+ if (((timeout.tv_sec != 0) || (timeout.tv_nsec != 0)) &&
+ (timeout_hz == 0))
+ timeout_hz = 1;
+
+
f = futex_get(args->uaddr);
ret = futex_sleep(f, td, timeout_hz);
futex_put(f);
More information about the p4-projects
mailing list