Skip site navigation (1)Skip section navigation (2)



index | | raw e-mail

diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h
index 2430b25c6915..e3ac4a05612c 100644
--- a/sys/compat/linuxkpi/common/include/linux/kernel.h
+++ b/sys/compat/linuxkpi/common/include/linux/kernel.h
@@ -351,4 +351,37 @@ mac_pton(const char *macin, uint8_t *macout)
 #define	DECLARE_FLEX_ARRAY(_t, _n)					\
     struct { struct { } __dummy_ ## _n; _t _n[0]; }
 
+/*
+ * The following functions/macros are debug/diagnostics tools. They default to
+ * no-ops, except `might_sleep()` which uses `WITNESS_WARN()` on FreeBSD.
+ */
+static inline void
+__might_resched(const char *file, int line, unsigned int offsets)
+{
+}
+
+static inline void
+__might_sleep(const char *file, int line)
+{
+}
+
+static inline void
+might_fault(void)
+{
+}
+
+#define	might_sleep()							\
+	WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "might_sleep()")
+
+#define	might_sleep_if(cond) do { \
+	if (cond) { might_sleep(); } \
+} while (0)
+
+#define	might_resched()		do { } while (0)
+#define	cant_sleep()		do { } while (0)
+#define	cant_migrate()		do { } while (0)
+#define	sched_annotate_sleep()	do { } while (0)
+#define	non_block_start()	do { } while (0)
+#define	non_block_end()		do { } while (0)
+
 #endif	/* _LINUXKPI_LINUX_KERNEL_H_ */
diff --git a/sys/compat/linuxkpi/common/include/linux/wait.h b/sys/compat/linuxkpi/common/include/linux/wait.h
index 03ddce2c06f5..698a1056b713 100644
--- a/sys/compat/linuxkpi/common/include/linux/wait.h
+++ b/sys/compat/linuxkpi/common/include/linux/wait.h
@@ -43,13 +43,6 @@
 
 #define	SKIP_SLEEP() (SCHEDULER_STOPPED() || kdb_active)
 
-#define	might_sleep()							\
-	WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "might_sleep()")
-
-#define	might_sleep_if(cond) do { \
-	if (cond) { might_sleep(); } \
-} while (0)
-
 struct wait_queue;
 struct wait_queue_head;
 


home | help