diff options
author | Ian Lepore <ian@FreeBSD.org> | 2017-07-29 17:00:23 +0000 |
---|---|---|
committer | Ian Lepore <ian@FreeBSD.org> | 2017-07-29 17:00:23 +0000 |
commit | d35f6548e63e5deb4e9a7ac40f517fc10b1dc7b9 (patch) | |
tree | 1d03792203de7ff3833ff67d9b0566c7b343720e /sys/nfs | |
parent | 088c1ddd569ce0cbf5ead70af9e972a9f8292591 (diff) | |
download | src-d35f6548e63e5deb4e9a7ac40f517fc10b1dc7b9.tar.gz src-d35f6548e63e5deb4e9a7ac40f517fc10b1dc7b9.zip |
Add inline functions to convert between sbintime_t and decimal time units.
Use them in some existing code that is vulnerable to roundoff errors.
The existing constant SBT_1NS is a honeypot, luring unsuspecting folks into
writing code such as long_timeout_ns*SBT_1NS to generate the argument for a
sleep call. The actual value of 1ns in sbt units is ~4.3, leading to a
large roundoff error giving a shorter sleep than expected when multiplying
by the trucated value of 4 in SBT_1NS. (The evil honeypot aspect becomes
clear after you waste a whole day figuring out why your sleeps return early.)
Notes
Notes:
svn path=/head/; revision=321686
Diffstat (limited to 'sys/nfs')
0 files changed, 0 insertions, 0 deletions