summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/uts/common/sys/stddef.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/usr/src/uts/common/sys/stddef.h b/usr/src/uts/common/sys/stddef.h
index 9dc9736241..a0bd1f83a1 100644
--- a/usr/src/uts/common/sys/stddef.h
+++ b/usr/src/uts/common/sys/stddef.h
@@ -37,8 +37,16 @@ extern "C" {
#endif /* !offsetof */
#if !defined(container_of)
+
+/*
+ * We must not expose container_of() to userland, but we want it
+ * to be available for early boot and for the kernel.
+ */
+#if ((defined(_KERNEL) || defined(_FAKE_KERNEL)) && !defined(_KMEMUSER)) || \
+ (defined(_BOOT) && defined(_KMEMUSER))
#define container_of(m, s, name) \
(void *)((uintptr_t)(m) - (uintptr_t)offsetof(s, name))
+#endif
#endif /* !container_of */
#ifdef __cplusplus