aboutsummaryrefslogtreecommitdiff
path: root/sys/cddl/compat
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2010-01-25 07:52:54 +0000
committerXin LI <delphij@FreeBSD.org>2010-01-25 07:52:54 +0000
commit63243c5c717a140d9f83eda3864afbdd32f6ce77 (patch)
treeb960e36c5853b0e56785cf16ad5c06397009dceb /sys/cddl/compat
parent6941401c8717acfbf7d51ef65a5f74d934ef88cd (diff)
downloadsrc-63243c5c717a140d9f83eda3864afbdd32f6ce77.tar.gz
src-63243c5c717a140d9f83eda3864afbdd32f6ce77.zip
On FreeBSD, time_t is 64-bit for all platforms except i386 and powerpc,
where the type is 32-bit. ZFS can handle 64-bit timestamp internally but zfs_setattr() would check if the time value can fit, we change the checking macros to match 64-bit timestamp if the platform supports it. This change has some downsides like, while you can import zfs on 32-bit platforms, the timestamp would overflow if they are out of the range. This fixes the Y2.038K issue on platforms using 64-bit timestamps. Reviewed by: pjd MFC after: 1 month
Notes
Notes: svn path=/head/; revision=202964
Diffstat (limited to 'sys/cddl/compat')
-rw-r--r--sys/cddl/compat/opensolaris/sys/time.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/cddl/compat/opensolaris/sys/time.h b/sys/cddl/compat/opensolaris/sys/time.h
index 0bf1e9bf6b82..4275790bebe5 100644
--- a/sys/cddl/compat/opensolaris/sys/time.h
+++ b/sys/cddl/compat/opensolaris/sys/time.h
@@ -40,8 +40,13 @@ typedef longlong_t hrtime_t;
#define LBOLT ((gethrtime() * hz) / NANOSEC)
+#if defined(__i386__) || defined(__powerpc__)
#define TIMESPEC_OVERFLOW(ts) \
((ts)->tv_sec < INT32_MIN || (ts)->tv_sec > INT32_MAX)
+#else
+#define TIMESPEC_OVERFLOW(ts) \
+ ((ts)->tv_sec < INT64_MIN || (ts)->tv_sec > INT64_MAX)
+#endif
#ifdef _KERNEL
#define lbolt64 (int64_t)(LBOLT)