summaryrefslogtreecommitdiffstats
path: root/sys/cddl/compat
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2013-09-10 01:46:47 +0000
committerdelphij <delphij@FreeBSD.org>2013-09-10 01:46:47 +0000
commita23043347caa65ac4c8e91f806ab2319dbbd657c (patch)
tree0687bff9ba2d5136268f4e5308ff47b239b85978 /sys/cddl/compat
parent545d815a3b9493ec2dee3f291049b47655c1ec46 (diff)
downloadFreeBSD-src-a23043347caa65ac4c8e91f806ab2319dbbd657c.zip
FreeBSD-src-a23043347caa65ac4c8e91f806ab2319dbbd657c.tar.gz
MFV r247844 (illumos-gate 13975:ef6409bc370f)
Illumos ZFS issues: 3582 zfs_delay() should support a variable resolution 3584 DTrace sdt probes for ZFS txg states Provide a compatibility shim for Solaris's cv_timedwait_hires to help aid future porting. Approved by: re (ZFS blanket)
Diffstat (limited to 'sys/cddl/compat')
-rw-r--r--sys/cddl/compat/opensolaris/sys/kcondvar.h15
-rw-r--r--sys/cddl/compat/opensolaris/sys/time.h3
2 files changed, 18 insertions, 0 deletions
diff --git a/sys/cddl/compat/opensolaris/sys/kcondvar.h b/sys/cddl/compat/opensolaris/sys/kcondvar.h
index 7c68842..bae053f 100644
--- a/sys/cddl/compat/opensolaris/sys/kcondvar.h
+++ b/sys/cddl/compat/opensolaris/sys/kcondvar.h
@@ -1,5 +1,6 @@
/*-
* Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
+ * Copyright (c) 2013 iXsystems, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -36,6 +37,7 @@
#include <sys/mutex.h>
#include <sys/condvar.h>
+#include <sys/time.h>
typedef struct cv kcondvar_t;
@@ -57,6 +59,19 @@ typedef enum {
} while (0)
#define cv_init(cv, name, type, arg) zfs_cv_init(cv, name, type, arg)
+static clock_t
+cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, hrtime_t res,
+ int flag)
+{
+ sbintime_t sbt;
+ sbintime_t pr;
+
+ sbt = tim * SBT_1NS;
+ pr = res * SBT_1NS;
+
+ return (cv_timedwait_sbt(cvp, mp, sbt, pr, 0));
+}
+
#endif /* _KERNEL */
#endif /* _OPENSOLARIS_SYS_CONDVAR_H_ */
diff --git a/sys/cddl/compat/opensolaris/sys/time.h b/sys/cddl/compat/opensolaris/sys/time.h
index 2e83447..1f210c5 100644
--- a/sys/cddl/compat/opensolaris/sys/time.h
+++ b/sys/cddl/compat/opensolaris/sys/time.h
@@ -37,6 +37,9 @@
#define NANOSEC 1000000000
#define TIME_MAX LLONG_MAX
+#define MSEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / MILLISEC))
+#define NSEC2MSEC(n) ((n) / (NANOSEC / MILLISEC))
+
typedef longlong_t hrtime_t;
#if defined(__i386__) || defined(__powerpc__)
OpenPOWER on IntegriCloud