summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormm <mm@FreeBSD.org>2011-02-01 14:28:50 +0000
committermm <mm@FreeBSD.org>2011-02-01 14:28:50 +0000
commitcab1b4d893ce4fd52a044414a075f596a9c6ccc6 (patch)
tree2e8ee40cee3c2892c4f48093a0de14376e76eb25
parentd690434e20997eb77185336e6858f63acfc2f114 (diff)
downloadFreeBSD-src-cab1b4d893ce4fd52a044414a075f596a9c6ccc6.zip
FreeBSD-src-cab1b4d893ce4fd52a044414a075f596a9c6ccc6.tar.gz
For ZFS, change the type of clock_t to int64_t.
The clock_t type in OpenSolaris is long (int64_t on amd64). On FreeBSD clock_t is int32_t. The clock_t type is used in several places in the ZFS code to store system uptime in milliseconds ("seconds * hz"). With hz=1000 we have a 32-bit integer overflow in 24 days, 20 hours, 31 minutes and 23.648 seconds. This has a user reported negative impact on l2arc_feed_thread() and may cause unexpected results from other functions using clock_t. Reported by: Artem Belevich <fbsdlist@src.cx> on freebsd-fs@ MFC after: 1 week
-rw-r--r--sys/cddl/compat/opensolaris/sys/types.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/cddl/compat/opensolaris/sys/types.h b/sys/cddl/compat/opensolaris/sys/types.h
index 069ad45..e863e4b 100644
--- a/sys/cddl/compat/opensolaris/sys/types.h
+++ b/sys/cddl/compat/opensolaris/sys/types.h
@@ -34,6 +34,10 @@
*/
#include <sys/stdint.h>
+
+typedef int64_t clock_t;
+#define _CLOCK_T_DECLARED
+
#include_next <sys/types.h>
#define MAXNAMELEN 256
OpenPOWER on IntegriCloud