aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libspl/include/sys
diff options
context:
space:
mode:
authorMatthew Macy <[email protected]>2019-10-25 13:38:37 -0700
committerBrian Behlendorf <[email protected]>2019-10-25 13:38:37 -0700
commit68a1b1589ad60f9c07d3299f7068ad29fb47e695 (patch)
tree7ee3570abba8be5f7769e7aa1973d538f151ce73 /lib/libspl/include/sys
parentb4238327b4ec84451fd2944cee7ccff37a065d27 (diff)
Remove sdt.h
It's mostly a noop on ZoL and it conflicts with platforms that support dtrace. Remove this header to resolve the conflict. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Jorgen Lundman <[email protected]> Signed-off-by: Matt Macy <[email protected]> Closes #9497
Diffstat (limited to 'lib/libspl/include/sys')
-rw-r--r--lib/libspl/include/sys/trace_defs.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/libspl/include/sys/trace_defs.h b/lib/libspl/include/sys/trace_defs.h
index a96e29318..058b9e8ec 100644
--- a/lib/libspl/include/sys/trace_defs.h
+++ b/lib/libspl/include/sys/trace_defs.h
@@ -1 +1,24 @@
/* Here to keep the libspl build happy */
+
+#ifndef _LIBSPL_ZFS_TRACE_H
+#define _LIBSPL__ZFS_TRACE_H
+
+/*
+ * The set-error SDT probe is extra static, in that we declare its fake
+ * function literally, rather than with the DTRACE_PROBE1() macro. This is
+ * necessary so that SET_ERROR() can evaluate to a value, which wouldn't
+ * be possible if it required multiple statements (to declare the function
+ * and then call it).
+ *
+ * SET_ERROR() uses the comma operator so that it can be used without much
+ * additional code. For example, "return (EINVAL);" becomes
+ * "return (SET_ERROR(EINVAL));". Note that the argument will be evaluated
+ * twice, so it should not have side effects (e.g. something like:
+ * "return (SET_ERROR(log_error(EINVAL, info)));" would log the error twice).
+ */
+#undef SET_ERROR
+#define SET_ERROR(err) \
+ (__set_error(__FILE__, __func__, __LINE__, err), err)
+
+
+#endif